[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [eclipselink-users] multiple PUs/db catalogs ?
|
Different schema per customer.
A good way of doing this would be to config the Entitymanager by its
annotation ?:
@PersistenceContext(properties={ ... })
private EntityManager em;
I will then use one session bean per customer.
This should remove the need of one persistence.xml per PU instance ?.
If that is currently not supported, could i please get some guideline
how to implement it in the eclipselink codebase.
Runtime dynamic creation of persistence units is something that ofcourse
would be very nice to have,
removing the need for project deployments to handle new customers.
Due to its complexity, im for now willing to skip it.
regards
gustav trede
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