I need to use multiple persistence units with different properties (in my case MySQL and Oracle database). In persistence.xml I define two different "persistence-unit"s and list only the entity classes there.
Properties could be set in persitence.xml with
<properties> <property name="..." value="..." /> ...
Im doing it in a java class before creating the EntityManager, because I must use different properties (which I read before):
EntityManagerFactory factory;
...
HashMap<String, String> dbProperties = new HashMap<String, String>();
dbProperties.put("javax.persistence.jdbc.driver", driver);
dbProperties.put("javax.persistence.jdbc.url", url);
dbProperties.put("javax.persistence.jdbc.user", user);
dbProperties.put("javax.persistence.jdbc.password", password);
dbProperties.put("eclipselink.ddl-generation", "none");
dbProperties.put("eclipselink.ddl-generation.output-mode", "database");
factory = Persistence.createEntityManagerFactory(PERSISTENCE_UNIT_NAME, dbProperties);
EntityManager em = factory.createEntityManager();
...
For Oracle I need to set Schema dynamicly (if possible) and not hardcoded in @Table annotation in each Entity class. And I guess there will be other properties I need to set. So my question is: is there a way I can find all avaible properties for the EntityManager?