I have an ear file which contains only the basic configuration:
Code:
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
version="2.0">
<persistence-unit name="tdaSupply">
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
<jta-data-source>java:jboss/datasources/tda-sql-DS</jta-data-source>
<class>de.gevas.tda.supply.element.SupplyElement</class>
….
<exclude-unlisted-classes />
</persistence-unit>
</persistence>
The properties I want to set external.
Inside the documentation:
https://docs.jboss.org/hibernate/orm/3. ... ogrammaticI read, that I can define the path to hibernate.property with the parameter -Dproperty
Because I want to use different property files I start WildFly with this line for example:
Code:
-Dproperty=C:/Mapping/D/Server/WildFly/wildfly_aktuell/standalone/configuration/gevas/standalone/configuration/gevas/hibernate_postgres.properties
The entityManager I get this way:
@PersistenceContext(unitName = "tdaSupply")
protected EntityManager entityManager;
In my program I can read the SystemProperty "property" with success.
But it seems, that hibernate can not find the property file. In my logfiie I can find this:
hibernate.cfg.Environment [ INFO] 20170412 14:39:38.769 ServerService Thread Pool -- 23 HHH000206: hibernate.properties not found
The entityManager is created with some standard properties which I have logged out with
Map<String, Object> properties = entityManager.getEntityManagerFactory().getProperties();
for(Map.Entry<String, Object> e : properties.entrySet())
{
logger.info("enMgr key = " + e.getKey() + ", val = " + e.getValue().toString());
}
There I can not find my properties from the external file.
It is not possible for me to use only one hibernate.properties file inside the ear, because I have to be flexible with every start of the WildFly and I can not manage two ear files. Reason is test with jenkins and all databases for example.
What is wrong?