-
Notifications
You must be signed in to change notification settings - Fork 73
Description
The following list of tests is failing because the TCK assumes it can set a version property manually:
com/sun/ts/tests/jpa/core/annotations/version/Client.java#intFieldTestcom/sun/ts/tests/jpa/core/annotations/version/Client.java#intPropertyTestcom/sun/ts/tests/jpa/core/annotations/version/Client.java#integerFieldTestcom/sun/ts/tests/jpa/core/annotations/version/Client.java#integerPropertyTestcom/sun/ts/tests/jpa/core/annotations/version/Client.java#longClassFieldTestcom/sun/ts/tests/jpa/core/annotations/version/Client.java#longClassPropertyTestcom/sun/ts/tests/jpa/core/annotations/version/Client.java#longFieldTestcom/sun/ts/tests/jpa/core/annotations/version/Client.java#longPropertyTestcom/sun/ts/tests/jpa/core/annotations/version/Client.java#shortClassFieldTestcom/sun/ts/tests/jpa/core/annotations/version/Client.java#shortClassPropertyTestcom/sun/ts/tests/jpa/core/annotations/version/Client.java#shortFieldTestcom/sun/ts/tests/jpa/core/annotations/version/Client.java#shortPropertyTestcom/sun/ts/tests/jpa/core/annotations/version/Client.java#timestampFieldTestcom/sun/ts/tests/jpa/core/annotations/version/Client.java#timestampPropertyTest
The problem is in the various createXTestData methods that pass a non-null value in the entity constructors for the version. According to the JPA spec section 3.4.2:
An entity may access the state of its version field or property or export a method for use by the application to access the version, but must not modify the version value.[32] With the exception noted in Section 4.10, only the persistence provider is permitted to set or update the value of the version attribute in the object.
So the TCK violates the rules of the specification by setting the version.
Hibernate ORM leverages the nullity to determine whether an entity instance is detached or transient, which should be ok according to the specification.