Cannot use an EntityTransaction while using JTA.
This is my persistence.xml. I get this message in the log when I try to save the record.
Caused by: java.lang.IllegalStateException:
Exception Description: Cannot use an EntityTransaction while using JTA.
<persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence persistence_1_0.xsd" version="1.0">
<persistence-unit name="NAME" transaction-type="JTA">
<provider>
org.eclipse.persistence.jpa.PersistenceProvider
</provider>
<class>my class name</class>
<properties>
<property name="eclipselink.logging.level" value="SEVERE"/>
<property name="javax.persistence.jtaDataSource" value="jdbc/DSNAME"/>
</properties>
</persistence-unit>
</persistence>
In another class method I have a method that contains the entity manager code:
try {
em.getTransaction().begin();
em.merge(classname); //
em.flush();
em.getTransaction().commit();
} finally {
em.close();
}
}
I tried commenting out the begin, commit and flush so to use JTA instead of Resource local Entity Manager. But that just results in no error messages the merge does not save any changes to the database
Edited by: user597294 on Jan 10, 2012 6:55 AM
Edited by: user597294 on Jan 10, 2012 7:14 AM