Alex Rivera | Logout

Hibernate JPA and Spring javax.persistence.TransactionRequiredException: no transaction is in progress

Asked 2009-11-26T06:11:07.750
26

When I call:

entityManager.flush()

I get the exception mentioned in the title.

I am using Hibernate JPA.

Edit
Report

2 Answers

0

Same was happening to me using spring 3.0.0 / 3.0.3. Data was persisted in MySQL from JUnit but not from the tomcat server. After so much work I gave up on RESOURCE_LOCAL for JTA.

This worked for me http://erich.soomsam.net/2007/04/24/spring-jpa-and-jta-with-hibernate-and-jotm/ It uses JTA and depends on JOTM.

answered 2010-07-23T06:50:19.193
0

I did all the thing as a following. My problems was with "import" tag, there are several context root like servlet-context and root-context which are not dependent on each other. It becomes clear with Spring Explorer view in STS. No JTA for Tomcat.

My advice would be universal: run Pet Clinic on your environment , How to run Spring 3.0 PetClinic in tomcat with Hibernate backed JPA or generate with Roo stub of application and try to compare your configs with referenced.

answered 2011-06-29T15:49:45.987

Your Answer