You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@openjpa.apache.org by Chris Wolf <cw...@gmail.com> on 2013/03/06 18:00:35 UTC

What is the "best practice" when composing persistence.xml to run in JSE?

Should I use javax.persistence.jdbc.* properties or
openjpa.Connection* properties?

Also, just an observation:  after reading the docs, I found that if I
omit specifying the "transaction-type" attribute of the
"persistence-unit" element, it will automagically pick the correct
type depending on whether it's running standalone (JSE) or deployed to
a JEE container (in my case, JBoss6).  Furthermore, (I could be wrong,
but this the behavior I am seeing) - when deployed to the JEE
container, the container-provided connection will be identified by the
JNDI resource name, specified by the "jta-data-source" element and the
"openjpa.Connection*" properties seem to be ignored (thankfully)...
yet when running in a standalone JSE app, "jta-data-source" seems to
be ignored and the "openjpa.Connection*" properties are in effect.
The end result is that I can use the same persistence.xml, without
editing, to deploy to either standalone (JSE) or app server (JBoss-6,
JEE).  This is pretty convenient, I wonder if this is by design?

Thanks,

Chris