Per the JPA 1.0 spec: "The transaction-type attribute is used to specify whether the entity managers provided by the entity manager factory for the persistence unit must be JTA entity managers or resource-local entity managers. The value of this element is JTA or RESOURCE_LOCAL. A transaction-type of JTA assumes that a JTA data source will be provided—either as specified by the jta-data-source element or provided by the container. In general, in Java EE environments, a transaction-type of RESOURCE_LOCAL assumes that a non-JTA datasource will be provided. In a Java EE environment, if this element is not specified, the default is JTA. In a Java SE environment, if this element is not specified, a default of RESOURCE_LOCAL may be assumed."
Although I can't say for certain whether or not OpenJPA tries to do something tricky to allow this. Maybe someone else on the list will have more info. -- Thanks, Rick On Tue, Apr 20, 2010 at 4:32 AM, BenBrott <[email protected]>wrote: > > I have not been able to make OpenJPA 1.2 work in Glassfish 2.1.1 without > having a jta-data-source referenced in persistencexml. So this > persistence.xml does not work because of no jta-datasource (default > datasource in Glassfish is used instead of my setup): > > <persistence version="1.0" > > <persistence-unit name="entityManager" transaction-type="JTA"> > > <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider> > <class>domain.Player</class> > <class>domain.Account</class> > <properties> > <property name="openjpa.ConnectionURL" > value="jdbc:jtds:sqlserver://localhost:1433/DB1" /> > <property name="openjpa.ConnectionDriverName" > value="net.sourceforge.jtds.jdbc.Driver" /> > <property name="openjpa.ConnectionUserName" > value="DB1" /> > <property name="openjpa.ConnectionPassword" > value="DB1" /> > </properties> > </persistence-unit> > </persistence> > > This works better: > <persistence version="1.0" > > <persistence-unit name="entityManager" transaction-type="JTA"> > > <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider> > <jta-data-source>DB1_Datasource</jta-data-source> > <class>domain.Player</class> > <class>domain.Account</class> > <properties> > </properties> > </persistence-unit> > </persistence> > > So I am trying to use container managed transactions from EJB3 stateless > beans using OpenJPA as persistence provider. The reason why I try to use > the > openjpa.ConnectionURL configuration is because I want to use Slice in > OpenJPA. > -- > View this message in context: > http://n2.nabble.com/OpenJPA-without-jta-data-source-in-persistence-xml-tp4930234p4930234.html > Sent from the OpenJPA Users mailing list archive at Nabble.com. >
