|
Re: How can I check PersistenceContexts for equality [message #757806 is a reply to message #757045] |
Mon, 21 November 2011 18:36 |
|
You EntityManager can either be JTA managed, or RESOURCE_LOCAL unmanaged.
If it is unmanaged, then every time you call createEntityManager, you will get a new EntityManager.
If it is JTA managed, then the EJB container is responsible for creating the EntityManager instance.
The way EJB servers do this is they wrap the real EclipseLink EntityManager in there own proxy. Every transaction will get a different EclipseLink EntityManager, and entity managers should reference the same EclipseLink EntityManager in the same transaction.
In WebLogic and Glassfish I believe a new EclipseLink EntityManager is created each transaction, and thrown away at the end.
In WebSphere I believe it does some caching of the EntityManager in some sort of pool and just calls clear() on them and then puts them back into the pool.
I do not recommend pooling EntityManagers.
James : Wiki : Book : Blog : Twitter
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04406 seconds