persistence@glassfish.java.net

Re: Question about "switching" JTA datasources in glassfish when using Toplink

From: Marina Vatkina <Marina.Vatkina_at_Sun.COM>
Date: Fri, 01 Aug 2008 18:01:15 -0700

Hello Ravi,

You can set up 2 jdbc pools in GlassFish, and toggle jdbc-resource reference to
point to one pool or the other. You might need to restart the glassfish server
for TopLink to reread the settings and acquire new connections.

Regards,
-marina

Kulkarni, Ravi wrote:
> Hello,
>
>
>
> I’ve a web service deployed in Glassfish. The Web Service uses Toplink
> for the JPA. One of the requirements from the QA (and engineering team)
> is that whenever an issue is fixed; they want to first duplicate it in
> the original version of the Web Service and then verify it to be fixed
> in the latest version of the Web Service. The Web Service uses Toplink
> EntityManager and specifies the datasource in the persistence.xml. We
> are trying to see if we can deploy two versions of the Web Service on
> the same server (either under different path, ports or virtual server).
> However; as the persistence.xml is compiled-in into the .ear; we have no
> easy way of changing the datasource used by the Web Service. I.e.;
> without re-compiling the source; we want to say that yesterday the Web
> Service was using Datasource1; today the same Web Service should use
> Datasource2. We are okay if we have to restart glassfish to achieve this
> change.
>
>
>
> We understand that we would also require quite a few databases for this
> type of support. In my simple example; two; but someone from QA when
> verifying problems reported in multiple versions; may require those many
> databases.
>
>
>
> What are my options?
>
>
>
> Thanks
>
> - Ravi
>
>
>