diff --git a/api/src/main/java/jakarta/persistence/Version.java b/api/src/main/java/jakarta/persistence/Version.java index 5fdda757..d27d8bc8 100644 --- a/api/src/main/java/jakarta/persistence/Version.java +++ b/api/src/main/java/jakarta/persistence/Version.java @@ -41,7 +41,11 @@ * {@code long}, {@link Long}, {@code java.sql.Timestamp}, * {@link java.time.Instant}, {@link java.time.LocalDateTime}. * - *

This field declares a version number: + *

Any positive number or non-null timestamp + * initial value will be the seed of version, otherwise vendors are free to + * seed the version. + * + *

This field declares a version number, the version seed is vendor-specific: * * {@snippet : * @Version @@ -49,6 +53,14 @@ * protected int version; * } * + *

This field declares a version number, the version seed is 1 across vendors: + * + * {@snippet : + * @Version + * @Column(name = "REVISION") + * protected int version = 1; + * } + * *

This field declares a revision timestamp: * * {@snippet : diff --git a/spec/src/main/asciidoc/ch02-entities.adoc b/spec/src/main/asciidoc/ch02-entities.adoc index 4913d1c7..45153e30 100644 --- a/spec/src/main/asciidoc/ch02-entities.adoc +++ b/spec/src/main/asciidoc/ch02-entities.adoc @@ -1251,6 +1251,11 @@ hierarchy, or by one of its mapped superclasses. A portable application must not declare a version field or property in a subclass of the root class of an entity class hierarchy. +Any *positive number* or *non-null timestamp* initial value will be the seed of version, +otherwise vendors are free to seed the version. A portable application +should declare a version number field with positive initial value +to make the seed deterministic. + === Basic Types [[a486]] The following Java types are considered _basic types_: