ShortClass_Field a = getEntityManager().find(ShortClass_Field.class, "3");
ShortClass_Field a = getEntityManager().find(ShortClass_Field.class, "3");
log.info("shortFieldTest, a="+a);
if (a != null) {
    logTrace( "version:" + a.getVersion());
    // if (a.getVersion() == 1) {
    Short version = a.getVersion();
    log.info("shortFieldTest, a.version="+version);
    a.setName("two");
    getEntityTransaction().begin();
    getEntityManager().merge(a);
    getEntityManager().flush();
    getEntityTransaction().commit();
    ShortClass_Field a1 = getEntityManager().find(ShortClass_Field.class, "3");
    log.info("shortFieldTest, a1="+a1);
    if (a1 != null) {
       if (a1.getVersion() > version) {
In the above code a + a1 objects are:
a = {ee.jakarta.tck.persistence.core.annotations.version.ShortClass_Field} "ShortClass_Field[id: 3, version: null, name: null]"
 id = "3"
 basicShort = null
 name = null
 _persistence_primaryKey = "3"
 _persistence_cacheKey = null
 _persistence_listener = null
 _persistence_fetchGroup = null
 _persistence_shouldRefreshFetchGroup = false
 _persistence_session = null
a1 = {ee.jakarta.tck.persistence.core.annotations.version.ShortClass_Field@14253} "ShortClass_Field[id: 3, version: 1, name: two]"
 id = "3"
 basicShort = {java.lang.Short@14333} 1
  value = 1
 name = "two"
 _persistence_primaryKey = "3"
 _persistence_cacheKey = null
 _persistence_listener = {org.eclipse.persistence.internal.descriptors.changetracking.AttributeChangeListener@14334} "AttributeChangeListener(null)"
 _persistence_fetchGroup = null
 _persistence_shouldRefreshFetchGroup = false
 _persistence_session = null
The last line of code is "a1.getVersion() > version" which will throw an exception since the "version" is null.
How can we get EclipseLink to assign value 0 when the ShortClass_Field is first persisted?
This failing test used to specify an initial value for version fields but changed for Jakarta EE 11 due to accepted challenge https://github.com/jakartaee/persistence/issues/637 to leave the version field as null since the Persistence Provider is expected to set the value of the @Version field.
Thoughts?
Scott