Please, could you confirm the equivalent JPA 2.0 lock modes are defined in the LockModeType and Hibernate LockMode:
- OPTIMISTIC (was READ in JPA 1.0) == LockMode.OPTIMISTIC The Entity will have its optimistic lock version checked on commit, to ensure no other transaction updated the object.
- OPTIMISTIC_FORCE_INCREMENT (was WRITE in JPA 1.0) == LockMode.OPTIMISTIC_FORCE_INCREMENT The Entity will have its optimistic lock version incremented on commit, to ensure no other transaction updated (or READ locked) the object.
- PESSIMISTIC_READ == LockMode.READ ??? The Entity is locked on the database, prevents any other transaction from acquiring a PESSIMISTIC_WRITE lock.
- PESSIMISTIC_WRITE == LockMode.PESSIMISTIC_WRITE; The Entity is locked on the database, prevents any other transaction from acquiring a PESSIMISTIC_READ or PESSIMISTIC_WRITE lock.
- PESSIMISTIC_FORCE_INCREMENT == LockMode.PESSIMISTIC_FORCE_INCREMENT; The Entity is locked on the database, prevents any other transaction from acquiring a PESSIMISTIC_READ or PESSIMISTIC_WRITE lock, and the Entity will have its optimistic lock version incremented on commit. This is unusual as it does both an optimistic and pessimistic lock, normally an application would only use one locking model. - NONE == LockMode.NONE No lock is acquired, this is the default to any find, refresh or query operation.
Thank you so much,
Best regards.
|