Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions documentation/src/main/asciidoc/introduction/Entities.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,18 @@ It's easy to specify that the initial version should be assigned the number `1`
int version = 1; // the initial version number
----

If the version attribute is an `Instant` or datetime, the value assigned to the attribute is generated in the JVM by default.

[TIP]
====
If the datetime value should be generated by the database, the `@Version` annotation may be used in conjunction with a <<user-defined-generators,generator annotation>>, for example:
[source,java]
----
@CurrentTimestamp @Version
LocalDateTime lastUpdated;
----
====

Almost every entity which is frequently updated should have a version attribute.

[TIP]
Expand Down
Loading