1Z0-898 · Question #22
A named query that sets an exclusive pessimistic on the entities returned by the query by setting the NamedQuery lockMode element to LockModeType.PESSIMISTIC_FORCE_INCREMENT. The application starts…
The correct answer is A. Only the current transition may modify or delete the entity instances. The lock modes LockModeType.PESSIMISTIC_READ, LockModeType.PESSIMISTIC_WRITE, and LockModeType.PESSIMISTIC_FORCE_INCREMENT are used to immediately obtain long- term database locks. The semantics of requesting locks of type LockModeType.PESSIMISTIC_READ…
Question
A named query that sets an exclusive pessimistic on the entities returned by the query by setting the NamedQuery lockMode element to LockModeType.PESSIMISTIC_FORCE_INCREMENT. The application starts transaction and executes the query. Which of the following statements is correct about the entities returned by the query?
Options
- AOnly the current transition may modify or delete the entity instances.
- BThe current transaction may NOT modify or delete the entity instances.
- COther concurrent transactions may modify or delete the entity instances.
- DOther concurrent transactions may modify but MAY NOT delete the entity instances.
How the community answered
(39 responses)- A79% (31)
- B13% (5)
- C3% (1)
- D5% (2)
Explanation
The lock modes LockModeType.PESSIMISTIC_READ, LockModeType.PESSIMISTIC_WRITE, and LockModeType.PESSIMISTIC_FORCE_INCREMENT are used to immediately obtain long- term database locks. The semantics of requesting locks of type LockModeType.PESSIMISTIC_READ, LockModeType.PESSIMISTIC_WRITE, and LockModeType.PESSIMISTIC_FORCE_INCREMENT are the following. If transaction T1 calls for a lock of type LockModeType.PESSIMISTIC_READ or LockModeType.PESSIMISTIC_WRITE on an object, the entity manager must ensure that neither of the following phenomena can occur: P1 (Dirty read): Transaction T1 modifies a row. Another transaction T2 then reads that row and obtains the modified value, before T1 has committed or rolled back. P2 (Non-repeatable read): Transaction T1 reads a row. Another transaction T2 then modifies or deletes that row, before T1 has committed or rolled back. PESSIMISTIC_FORCE_INCREMENT Pessimistic write lock, with version update.
Topics
Community Discussion
No community discussion yet for this question.