nerdexam
Oracle

1Z0-898 · Question #11

It a Persistence application locks entity x with a pessimistic lock, which statement is true?

The correct answer is D. If a lock cannot be obtained, the Persistence provider must throw an exception. When the lock cannot be obtained, and the database locking failure results in transaction-level rollback, the provider must throw the PessimisticLockException and ensure that the JTA transaction or EntityTransaction has been marked for rollback.

Advanced Topics

Question

It a Persistence application locks entity x with a pessimistic lock, which statement is true?

Options

  • APersistence provider can defer obtaining the lock until the next synchronization of an entity to the
  • BA Persistenceprovider will obtain the lock when the entity is refreshed from the database.
  • CA Persistence provider is not required to support the LockModeType. PESSIMISTIC_WRITE
  • DIf a lock cannot be obtained, the Persistence provider must throw an exception.

How the community answered

(25 responses)
  • A
    4% (1)
  • B
    8% (2)
  • C
    12% (3)
  • D
    76% (19)

Explanation

When the lock cannot be obtained, and the database locking failure results in transaction-level rollback, the provider must throw the PessimisticLockException and ensure that the JTA transaction or EntityTransaction has been marked for rollback.

Topics

#pessimistic lock#PessimisticLockException#lock acquisition#lock behavior

Community Discussion

No community discussion yet for this question.

Full 1Z0-898 Practice