persistence@glassfish.java.net

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

From: Kulkarni, Ravi <Ravi_Kulkarni_at_intuit.com>
Date: Fri, 1 Aug 2008 17:32:24 -0700

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