When a @Version is declared in @MappedSuperclass, creating an instance succeeds, but deleting fails with stack trace shown below.
The same failure occurs if the version is defined in the super class that uses JOINED strategy. It will more likely occur for other inheritance strategies, but I haven't investigated this.
The version of the object extracted from the database is correct (the field value in the debugger). The problem occurs because the code in PersistentClassROF.getObjectForApplicationId() calls AbstractClassMetaData.getVersionMetaData() for a concrete class, and getVersionMetaData() returns null because the concrete class does not have @Version field annotation: the annotation is declared in the @MappedSuperclass
When getVersionMetaData() returns null, the execution skips the code that assigns the version number to ObjectProvider (sm), even though sm.myPC (the fetched object) has the correct version number.
I will be checking Hibernate if it correctly processes @MappedSuperclass and @Inheritance I'll consider switching to Hibernate because declaring @Version in concrete classes is tedious when there are many entities in the application.