Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » How can I check PersistenceContexts for equality
How can I check PersistenceContexts for equality [message #757994] Wed, 16 November 2011 08:50
info is currently offline infoFriend
Messages: 9
Registered: August 2010
Location: Bonn
Junior Member
Howdy Guys,

Is there a way to check if two EntityManagers instances represents the same PersistenceContext (container-managed, transaction-scoped) in EclipseLink?

Here is a paragraph from the JPA 2.0 specification:

7.8.2 Container Managed Persistence Contexts

> When operating with a third-party persistence provider, the container uses the contracts defined in section 7.9 to create and destroy container-managed persistence contexts. It is undefined whether a new entity manager instance is created for every persistence context, or whether entity manager instances are sometimes reused. Exactly how the container maintains the association between persistence context and JTA transaction is not defined.

If I understand it correctly, the JPA specification doesn't mandates if single EntityManager can be reused to represent multiple PersistenceContexts or each EntityManager instance will represents only one PersistenceContext and at the end it'll be released.

My question is - how it's in the EclipseLink. Does it reuse the EntityManager? Can I do naive 'System.out.println(em)' and check the EntityManager default toString() value for PersistenceContexts equality?

Or maybe it's not the EclipseLink responsibility to create/reuse the EntityManagers but the Application Server?

Thanks a lot for any clarifications.

This question has been also asked on StackOverflow and Javaranch - without any luck.

Previous Topic:IllegalArgumentException: eclipselink.profiler
Next Topic:PerformanceMonitor in Standalone or OSGI environment?
Goto Forum:

Current Time: Tue Jun 19 01:12:07 GMT 2018

Powered by FUDForum. Page generated in 0.01541 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top