I am curious what happens if you attempt the extended locking if the Post is not yet associated with the PC. Does it work then? You'd have to use a query with that hint. As far as locking an entity already associated with PC, the point where this "breaks down" is org.hibernate.event.internal.DefaultLockEventListener#onLock. At the moment we only do the cascade if the incoming entity is being reassociated. However, this is a Hibernate-specific feature (true reattachment); in the JPA case the entity has to already be in the PC by contract. In that condition the cascading it skipped. |