Re: How can I check PersistenceContexts for equality [message #758029] |
Mon, 21 November 2011 13:36  |
Eclipse User |
|
|
|
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 : http://wiki.eclipse.org/EclipseLink : http://en.wikibooks.org/wiki/Java_Persistence : http://java-persistence-performance.blogspot.com/
|
|
|
Re: How can I check PersistenceContexts for equality [message #758382 is a reply to message #758029] |
Tue, 22 November 2011 18:17  |
Eclipse User |
|
|
|
Thanks a lot James!
You've provided me with a lot of interesting information :)
I would just like to ask - when you've said that:
James wrote on Mon, 21 November 2011 13:36
> 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.
by EntityManager and it's pooling/cache'ing - you referred to the Server's proxy for EntityManager or the JPA-Provider EntityManager itself?
Thanks a lot once again!
|
|
|
Powered by
FUDForum. Page generated in 0.03823 seconds