openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Dick <>
Subject Re: Integrating existing customized Datasource and Connection objects in JPA
Date Wed, 11 Aug 2010 18:45:25 GMT

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
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


View this message in context:
Sent from the OpenJPA Users mailing list archive at

View raw message