OPTIMISTIC_FORCE_INCREMENT is not incrementing version field of non-dirty entities

Description

According to the JPA 2 spec:

If transaction T1 calls lock(entity, LockModeType.OPTIMISTIC_FORCE_INCREMENT) on a versioned object, the entity manager must avoid the phenomena P1 and P2 (as with LockModeType.OPTIMISTIC) and must also force an update (increment) to the entity's version column. A forced version update may be performed immediately, or may be deferred until a flush or commit. If an entity is removed before a deferred version update was to have been applied, the forced version update
is omitted.

However, Hibernate is not incrementing the version field when the entity is not altered in the transaction:

However, the spec says — must also force an update (increment) to the entity's version column and does not give the option to ignore updating the version number if the entity was not dirty.

Environment

MySQL 5.1.53 with InnoDB, Hibernate 3.1.6 Final, Java 1.6.0_22

Assignee

Unassigned

Reporter

Behrang Saeedzadeh

Labels

None

Feedback Requested

None

Feedback Requested By

None

backPortable

None

Suitable for new contributors

None

Pull Request

None

backportDecision

None

backportReEvaluate

None

Priority

Major
Configure