-
Notifications
You must be signed in to change notification settings - Fork 183
Spring Lemon Commons JPA Guide
spring-lemon-commons-jpa
includes spring-lemon-commons-web and adds Spring Data JPA to it. It comes with a couple of features, discussed below.
LemonEntity
is a base JPA entity class, with support for auditing, optimistic locking, and permission evaluation. When you need any of these features in an entity, inherit that from this one.
Sometimes you'll need to execute some code only after a successful database commit. For example, you should send verification mail to a user only after his registration data is committed to the database. Use LecjUtils.afterCommit
method in such cases.
LecjUtils.ensureCorrectVersion
can be used for ensuring some data isn't stale, particularly after an edit request received from front-end. Check out how it's used when editing a user, in LemonService.updateUser
.