I have created a .par file that holds my annotated domain objects and annotated packages. It also contains a persistence.xml file, and this file has hardcoded property values that indicate the database driver, url, and credentials.
I want to be able to distribute this .par file without the database-specific information. I also want to distribute a mysql.jar, oracle.jar, or sybase.jar file that contains the JDBC driver and other configuration information. My intent is to allow the deployment of the .par file and the appropriate database-specific jar file in order for the EntityManagerFactory to be configured properly simply by the inclusion of the jar file.
I realize this would be a lot easier if I could use JNDI since this is an exact situation where it benefits, but I would like this process to work outside of the J2EE container. I don't think the Hibernate EntityManager has a JNDI provider does it? I could switch to a programmatic configuration, but I would really like this to work across other EJB3 implementations as well.
I'm interested to hear what some others may have done to allow more seamless swapping of databases in the hibernate configuration.
|