Skip to content

TCK should not set version on entity manually #637

@beikov

Description

@beikov

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#intFieldTest
  • com/sun/ts/tests/jpa/core/annotations/version/Client.java#intPropertyTest
  • com/sun/ts/tests/jpa/core/annotations/version/Client.java#integerFieldTest
  • com/sun/ts/tests/jpa/core/annotations/version/Client.java#integerPropertyTest
  • com/sun/ts/tests/jpa/core/annotations/version/Client.java#longClassFieldTest
  • com/sun/ts/tests/jpa/core/annotations/version/Client.java#longClassPropertyTest
  • com/sun/ts/tests/jpa/core/annotations/version/Client.java#longFieldTest
  • com/sun/ts/tests/jpa/core/annotations/version/Client.java#longPropertyTest
  • com/sun/ts/tests/jpa/core/annotations/version/Client.java#shortClassFieldTest
  • com/sun/ts/tests/jpa/core/annotations/version/Client.java#shortClassPropertyTest
  • com/sun/ts/tests/jpa/core/annotations/version/Client.java#shortFieldTest
  • com/sun/ts/tests/jpa/core/annotations/version/Client.java#shortPropertyTest
  • com/sun/ts/tests/jpa/core/annotations/version/Client.java#timestampFieldTest
  • com/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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    acceptedAccepted certification requestchallengeTCK challenge

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions