Details
Description
When using a @version field for locking purposes in one of the fields of a MappedSuperClass, things go wrong. Here is my situation:
SpecificUser extends of BaseUser
There is one mapped superclass containing things like createdOn, createdBy and finally the @version field named version.
Now, when I change a record, the following queries are created. The last one is faulty:
Query: UPDATE specificuser SET firstname = ? WHERE id = ?
Query: UPDATE baseuser SET version = version + 1 WHERE id = ? AND version = ?
Query: SELECT version FROM specificuser WHERE id = ? <======= should be: SELECT version FROM baseuser WHERE id = ?
You say Single Table Inheritance but specificuser and baseuser are two different tables? How does that work? With single table inheritance both specificuser and baseuser are in the same table.
Can you post your mappings? I am not convinced of this bug yet