Skip to content

Commit 8e4bae4

Browse files
committed
document use of @CurrentTimestamp @Version in the Short Guide
1 parent a67f5f9 commit 8e4bae4

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

documentation/src/main/asciidoc/introduction/Entities.adoc

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -458,6 +458,18 @@ It's easy to specify that the initial version should be assigned the number `1`
458458
int version = 1; // the initial version number
459459
----
460460

461+
If the version attribute is an `Instant` or datetime, the value assigned to the attribute is generated in the JVM by default.
462+
463+
[TIP]
464+
====
465+
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:
466+
[source,java]
467+
----
468+
@CurrentTimestamp @Version
469+
LocalDateTime lastUpdated;
470+
----
471+
====
472+
461473
Almost every entity which is frequently updated should have a version attribute.
462474

463475
[TIP]

0 commit comments

Comments
 (0)