persistence@glassfish.java.net

Re: multiple databases

From: Marina Vatkina <Marina.Vatkina_at_Sun.COM>
Date: Tue, 20 Nov 2007 14:14:11 -0800

The only idea that I had so far was to define several PUs (that are exactly the
same with the exception of the datasource ref), and lookup the EM (or EMF
depending on your setup) that corresponds to the datasource of your choice.

Regards,
-marina

Alessandro Pedrotti wrote:
> Any suggestion to this scenario
>
> DEVELOPMENT PLATFORM:
>
> 1 development database
>
> PRODUCTION ENVIRORMENT 1
>
> customer database 1
> customer database 2
> customer database 3
>
> PRODUCTION ENVIRORMENT 2
>
> customer database 4
> customer database 5
>
>
> how can i use persistencein ejbs in such envirorment? the persistence
> api cannot let me dynamically inject EntityManager.
> In a normal j2ee application i connect to database dynamically making a
> jndi lookup of the jdbc connection through normal jndi lookup, staring
> from the database jndi name.
>
> While the connection pool can be deployed outside the application
> (outside the .ear, it's only glassfish config), the persistence
> framework narrow me to have one ear that must fit the various
> persistence.xml units that points to each production database
>
> I've tried all the methods from documentation, but no workaround found
> for this trouble.
>
> Any suggestion?
>
> ANYONE THAT SHARE THE SAME PROBLEM? I THINK THIS IS A TROUBLE OF ALL
> J2EE IN-SERVICE APPLICATIONS....
>
>
> thanks in advance...
>