I have a application with JPA Hibernate without Spring and I need connect to multiple databases (with the same estructure).
The databases will be created for each client, and would have to use the same entity manager. Please I need some idea of how I can do that. I am not using Spring. My application uses MySql, JPA2, Hibernate and JSF.
Thank you!
If everything is the same, except for dbname/username/pass, then create a persistence.xml with a persistance unit, put everything there which is static.
Then use the following method to create the entity manager:
Supply the variable parameters in the map, like this: