jakartaee / persistence

https://jakartaee.github.io/persistence/
Other
186 stars 55 forks source link

TCK should not set version on entity manually #637

Open beikov opened 2 weeks ago

beikov commented 2 weeks ago

The following list of tests is failing because the TCK assumes it can set a version property manually:

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.

beikov commented 2 weeks ago

Here is the fix https://github.com/jakartaee/platform-tck/pull/1325

The tests should be excluded from the 3.1 and 3.2 TCK.

scottmarlow commented 1 week ago

List of Platform TCK tests for this challenge:

scottmarlow commented 1 week ago

https://github.com/jakartaee/platform-tck/pull/1334 is for Persistence 3.1 + Jakarta EE 10 Platform TCK

scottmarlow commented 1 week ago

Any Persistence 3.2 test excludes should be done by updating the tckrefactor branch:

For reference see git commit 4eb2b298eaf2a954f3c7e38e1da2a8fb6c8f1b85

scottmarlow commented 2 days ago

The staged https://www.eclipse.org/downloads/download.php?file=/ee4j/jakartaee-tck/jakartaee10/staged/eftl/jakarta-persistence-tck-3.1.5.zip contains an update for this TCK challenge.