0
votes

I have domain classes like Class A inherits Class B and C. I don't want any optimistic locking at Class A level but I want optimistic locking at class B level and not at class C level and in tables tableperhierarchy is true. I had tried to add

version (false)

in class A mappings closure and

version (true)

in class B mappings. But it always giving me version field as null even for class B objects as well. Anyone else too faced such issue? I am working on grails 2.1.0 and groovy 1.8.0.

1

1 Answers

0
votes

This seems not to be possible in Hibernate. There is a way to specify NONE as optimistic lock type, but in a hierarchy, it can be done only on the root entity.

You could extend class A by another abstract class VersionedA. Then all versioned entity classes can derive from VersionedA, and non-version ones can still extend A directly.