Home » Oracle » 1z0-898 » What two options describe what will happen when the create method is called within an application ‘ uses container managed transactions?
Given the following code:
Public void create () {
try {
doA () {
} catch (PersistenceException e) {}
try (doB) ();
} catch (PersistenceException e) {}
}
Calling method doA will cause an NonUniqueResultException to be thrown. Calling method doB will cause an EntityExistsException to be thrown.
What two options describe what will happen when the create method is called within an application ‘ uses container managed transactions? (Choose two)
A. Method doB will never be called.
B. The current transaction will continue after doA executes.
C. The current transaction will continue after doB executes.
D. The current transaction will be marked for rollback when doA is called.
E. The current transaction will be marked for rollback when doB is called.
Correct Answer: BE
Explanation/Reference:
Explanation:
B:
PersistenceExceptionis thrown by the persistence provider when a problem occurs. All instances of PersistenceException except for instances of NoResultException, NonUniqueResultException, LockTimeoutException, and QueryTimeoutException will cause the current transaction, if one is active, to be marked for rollback.
E: EntityExistsException is thrown by the persistence provider when EntityManager.persist(Object) is called and the entity already exists. The current transaction, if one is active, will be marked for rollback.
References:
Download Printable PDF. VALID exam to help you PASS.
|
|