If an application uses an extended persistence context, which of the following is true?

If an application uses an extended persistence context, which of the following is true?

If an application uses an extended persistence context, which of the following is true?

A.
The persistencecontext exists until all transactions invoked by the EntityManager complete.

B.
The persistence context exists until all transactions invoked by the EntityManagar complete and the ntityManager.clear () method is invoked.

C.
The persistence context exists until the EntityManagerinstance is closed.

D.
The persistence context exists until the EntityManagerFactory instance is closed.

Explanation:
http://java.boot.by/scbcd5-guide/ch07s03.html



Leave a Reply 1

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


Mohamed Fayek

Mohamed Fayek

Answer : C

The extended persistence context exists from the point at which the entity manager has been created (either by calling EntityManagerFactory.createEntityManager or by the container) until the entity manager is closed (enther by calling EntityManager.close or by the container).

Therefore, the life of an extended transaction manager spans beyond the transactions performed under the entity manager.

An application managed persistence context (which is always an extended persistence context) exists until the entity manager is closed by means of EntityManager.close.

A container managed extended persistence context can only exist for a stateful session bean and it exists until the bean is removed or otherwise destroyed.