We're updating the issue view to help you get more done. 

using OPTIMISTIC_FORCE_INCREMENT does not increment the version on flush()

Description

In my project I use Wildfly 10 and do the following :

1 2 3 4 5 6 7 @TransactionAttribute(TransactionAttributeType.REQUIRED) public DtoOfMyVersionedEntityWithName sampleMethod(){ MyVersionedEntityWithName e = em.find(MyVersionedEntityWithName.class,0l); em.lock(e, OPTIMISTIC_FORCE_INCREMENT); em.flush(); return new DtoOfMyVersionedEntityWithName(e); }

the problem is that the version is not incremented on flush but on JTA transaction commit - which means that my dto doesn't have correct version information which is a major problem for me.

the same issue is also mentioned here: https://stackoverflow.com/questions/17785963/different-behavior-for-optimistic-force-increment-in-hibernate-4-2-vs-3-6

Environment

Wildfly 10, oracle db

Status

Assignee

Unassigned

Reporter

AdamK

Fix versions

None

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Affects versions

5.0.10

Priority

Critical