Hi

The datasource is by spec indirect in EE so no issues here. Then with most
providers system properties are read as persistence unit properties.
Finally in TomEE you can set PERSISTENCEUNIT.<unit name>.<key>=<value> in
tomee properties including system properties.
Le 19 nov. 2014 05:36, "[email protected]" <[email protected]> a écrit :

> The question is: "how can the persistence.xml, which is generally included
> in the same JAR as the JPA domain objects and DAO related code (ie: classes
> that use entity manager) be configured to handle different database servers"
>
> There are two scenarios for this:
> 1. testing - currently thinking that Arquillian will handle this by
> deleting the persistence.xml and adding a testing specific one when the WAR
> is built as part of the unit test - Other ideas / suggestions?
> 2. run-time - for example the WAR is provided to several customers.  One
> customer runs Oracle and the other runs mysql.
>
> ==
> Generally planning to use either H2 or HSQLDB (maybe in memory) for JPA
> based testing and another DB in production (MySQL, PostgreSQL, Oracle)
>
> Changing the datasource independently of the JAR or Code is quite easy in
> a JEE container.  However the persistence.xml is generally tailored to a
> specific DB (see below) which creates the issue.
>
> ex:
>         <provider>...
>         <property> various... probably can add for multiple DB's
>                 and those that do not apply will be ignored.
>         hibernate.dialect
>         org.hibernate.dialect
>

Reply via email to