Skip to Main Content

Integration

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Cannot use an EntityTransaction while using JTA.

veena panditJan 10 2012 — edited Jan 12 2012
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
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 9 2012
Added on Jan 10 2012
4 comments
5,616 views