What three statements are correct? (Choose three)

An application that uses pessimistic locking calls an updateData method that results in a LockTimeoutException being thrown. What three statements are correct? (Choose three)

An application that uses pessimistic locking calls an updateData method that results in a LockTimeoutException being thrown. What three statements are correct? (Choose three)

A.
The current transaction continues.

B.
The current statement continues.

C.
The current transaction is rolled back.

D.
The current statement is rolled back.

E.
The LockTimeoutException can NOT be caught.

F.
The LockTimeoutException can be caught, and the updateData method retried.



Leave a Reply 4

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


Mohamed Fayek

Mohamed Fayek

it is correct answer : A D F

If the lock mode type is pessimistic and the entity instance is found but cannot be locked:
the PessimisticLockException will be thrown if the database locking failure causes transaction-level rollback
the LockTimeoutException will be thrown if the database locking failure causes only statement-level rollback

In this question, it is given that LockTimeoutException has been thrown. This means the code was not able to obtain the lock but that affected only the current statement. Hence, only the current statement will be rolled back and the transaction will continue.

IF LockTimeoutException will be thrown, the caller can catch it and simply (Pro JPA 2 BOOK)

Anas

Anas

Hi,
Are those questions still valid or not ?
Thank you

Tommy_Croatia_ZGB

Tommy_Croatia_ZGB

Correct answers are A, D and F.

If the lock mode type is pessimistic and the entity instance is found but cannot be locked:
* the PessimisticLockException will be thrown if the database locking failure causes transaction-level rollback
* the LockTimeoutException will be thrown if the database locking failure causes only statement-level rollback

In this question, it is given that LockTimeoutException has been thrown. This means the code was not able to obtain the lock but that affected only the current statement. Hence, only the current statement will be rolled back and the transaction will continue.