openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pinaki Poddar <ppod...@apache.org>
Subject Re: How to find entity belong which EntityManger?
Date Mon, 13 Jun 2011 20:56:21 GMT
OpenJPA Slice addresses the same aspects that other providers address in
their own way (Hibernate calls it Shards, do not know about EclipseLink
equivalent). In future, JPA specification will standardize the behavior
against multiple databases. It is necessitated by the interest in
multi-tenancy as the applications move into cloud computing environment. 

Hence, your effort investment in Slice (or some of its equivalent) would not
go waste. 

The important architectural concern is two separate persistent contexts
(i.e. EntityManager instances em1 and em2) connected to two separate
database instances has a fundamental limitation. One of the core premise of
JPA is that a persistence context forms a 'group' (in a mathematical sense
of the word) i.e. the entities of em1 *can not* refer to entities in em2.
Whereas, when an application is connected to multiple databases, at some
point or other, a requirement will arise that would require instances from
different databases to refer to each other. At that point, a solution has to
be considered that can bring entities from multiple databases into the
*same* persistent context. Slice does that today, so does Hibernate Shards.

-----
Pinaki 
--
View this message in context: http://openjpa.208410.n2.nabble.com/How-to-find-entity-belong-which-EntityManger-tp6470903p6471780.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Mime
View raw message