I need to deploy one Enterprise Application Repository (EAR) file across
multiple Websphere servers, eg a development,test,QA,and production server,
where the schema name varies depending on the server. This is actually a
legal or regulatory requirement - the EAR file deployed to production must
be the same EAR file that was deployed and test in QA, with no intervening
changes.

For internal frameworks, we generally 'dynamicize' properties in the EAR by
having a separate named folder the property file for each environment. Then,
runtime startup code can 'select' the  folder based on a JNDI value defined
on each server. That is not obviously not going to work for JPA and
persistence.xml. Is the schema property used at compile time? If so, that
would seem to rule out any possibility of making it dynamic.

I also looked at overriding the persistence.xml properties at runtime, eg
using an EntityManagerFactory instead of EntityManager injection, which
allows passing a property map. The problems i hit there, were that the EMF
method signatures in the documentation for 1.2.3_Snapshot (this is on
(Eclipse-based) Rad 7.5.5) did not seem to match the code,  plus I could not
figure out what the analog of the PersistenceContextType attribue of the
@PersistenceContext annotation is when using EMF vs injection; also i was
not sure if openjpa.jdbc properties could be passed; also I got the
impression that EM's created using an EMF might not behave in exactly the
same way as injected ones in terms of the persistenceContextType (eg the EMs
would always be PersistenceContextType=extended?) 

Is there any available solution for deploying the same EAR to different
servers and having JPA pick up a different schema value (and possibly other
properties) depending on a JNDI value or other value that varies per server?
I read that persistence.xml just has to be on the classpath,  so possibly it
could be external to the EAR, but that could be problematic since not all
the servers support symlinks (at least one is a windows server).



--
View this message in context: 
http://openjpa.208410.n2.nabble.com/making-properties-in-persistence-xml-dynamic-tp6228861p6228861.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Reply via email to