Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Problem with JTA transactions and OpenJPA

 
Stefan Berger
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I'm writing a little test application with JSF, CDI, EJB and JPA on JBoss 7. I have a JSF view, the backing bean holds a reference to an EJB which is injected. The EJB gets an EntityManager by injection creates and persists some data. I'm using OpenJPA 2.1.0 with a datasource defined in JBoss 7. The problem is that I always get the error "You cannot set autocommit during a managed transaction", although I do not change the autocommit settings in my code nor do I do any transaction handling in my code. All I do regarding database access is to call em.persist(...):





This is my persistence.xml file:


The definition of the datasource in JBoss 7:


The stacktrace:


Hope that somebody can help me!
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!