It depends on what you really need. The JPA specification allows you to specify a JNDI location for your DataSources when you create the EntityManagerFactory, but not when you create an EntityManager. If this is sufficient then you can use the javax.persistence.jtaDataSource, and javax.persistence.nonJtaDataSource properties to indicate the JNDI name for your datasource.
If you need to pass in the DataSource object, or need to use a different JNDI location for each EntityManager there's no JPA standard solution. OpenJPA version 2.0.0 or later (I'd recommend a 2.0.1-SNAPSHOT) provides a way to specify the JNDI location when you http://openjpa.apache.org/builds/latest/docs/manual/manual.html#ref_guide_dbsetup_setDSPerEM create the EntityManager . There are some known restrictions but the documentation can be found in the 2.1.0 manual (docs for 2.0.1 will be published with the final 2.0.1 release). I don't know if Hibernate provides a similar mechanism, but hopefully this helps. -mike -- View this message in context: http://openjpa.208410.n2.nabble.com/Integrating-existing-customized-Datasource-and-Connection-objects-in-JPA-tp5411498p5413438.html Sent from the OpenJPA Users mailing list archive at Nabble.com.
