Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [eclipselink-users] multiple PUs/db catalogs ?

Please post separate questions as separate posts.

Do you have a separate database for each customer, or all they all on the
same database, just in different schemas?

Essentially you need a separate persistence unit for each schema/database. 
They can all share the same classes and annotations/orm.xml, but each would
needs its own persistence.xml.  You can use a SessionCustomizer to set the
tableQualifier on the EclipseLink Session's DatabaseLogin, to set the
schema.  There should be a persistence unit property for the tableQualifier,
please log a bug for this.

If you need to create the persistence unit's dynamically, this is more
difficult.  Dynamic persistence units is not something JPA or EclipseLink
supports very well.  You could potentially create your own
EntityManagerFactory factory that handles dynamically creating an
EntityManagerFactory per customer.  You will need to manually create an
EclipseLink ServerSession using the same EclipseLink Project as your default
persistence unit and wrap it in an EclipseLink EntityManagerFactory.  If you
need this, you should also log an enhancement request for dynamic
persistence unit support.


Gustav Trede-2 wrote:
> 
> Hello,
> 
> How does people using j2ee/jpa/eclipselink handle the scenario where the 
> same logic db structure needs to exists in several instances?.
> ex:
> 
> one DB catalog for each customer.
> message driven bean per customer , each mdb needs an entitymanager with 
> its specific catalog.
> 
> regards
>   gustav
> 


-----
---
http://wiki.eclipse.org/User:James.sutherland.oracle.com James Sutherland 
http://www.eclipse.org/eclipselink/
 EclipseLink ,  http://www.oracle.com/technology/products/ias/toplink/
TopLink 
Wiki:  http://wiki.eclipse.org/EclipseLink EclipseLink , 
http://wiki.oracle.com/page/TopLink TopLink 
Forums:  http://forums.oracle.com/forums/forum.jspa?forumID=48 TopLink , 
http://www.nabble.com/EclipseLink-f26430.html EclipseLink 
Book:  http://en.wikibooks.org/wiki/Java_Persistence Java Persistence 
-- 
View this message in context: http://www.nabble.com/RE%3A-multiple-PUs-db-catalogs---tp18487653p18487653.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.



Back to the top