Which EntityManager API will lock entity x with a pessimistic lock?

Which EntityManager API will lock entity x with a pessimistic lock?

Which EntityManager API will lock entity x with a pessimistic lock?

A.
em.lock(x, LockModeType.WRITE)

B.
em.lock(x, LockModeType.PESSIMISTIC)

C.
em.lock(x, LockModeType.PESSIMISTIC_READ)

D.
em.lock(x, LockModeType.OPTIMISTIC_FORCE_INCREMENT)

Explanation:
http://www.objectdb.com/java/jpa/persistence/lock#Pessimistic_Locking_(pessimistic locking)



Leave a Reply 0

Your email address will not be published. Required fields are marked *