Your Internet Explorer version is not compatible with our shopping cart system. Please use version 9 or higher to avoid problems with your order(s). Close
I am using JPA with DB2,define database connection in PU,database schema is defined in Entity class’s annotation @Table’s property,but I want the database Schema to be configurable,not hard-coded in code,I want Schema name defined in PU,not code,so I can create Entity Manager from different PU,can I do that? How?
thanks in advance?
It is possible to configure Schema name from EntityManager class.
Below mentioned steps is one way to configure schema name from entitymanager.
1) Remove the attribute “schema” from @Table annotation.
2) Add <property name=”toplink.jdbc.schema” value=”Your Schema Name” />.By doing this you can create PU’s for each schema.
3) Now pass the required PU to createEntityManagerFactory() method in EntityManagerHelper.java