nerdexam
Oracle

1Z0-898 · Question #33

1Z0-898 Question #33: Real Exam Question with Answer & Explanation

The correct answer is B. The current transaction will continue after doA executes. E. The current transaction will be marked for rollback when doB is called.. 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 on

Question

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)

Options

  • AMethod doB will never be called.
  • BThe current transaction will continue after doA executes.
  • CThe current transaction will continue after doB executes.
  • DThe current transaction will be marked for rollback when doA is called.
  • EThe current transaction will be marked for rollback when doB is called.

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.

Community Discussion

No community discussion yet for this question.

Full 1Z0-898 Practice