my dog learned polymorphism*
The moose likes Object Relational Mapping and the fly likes Beginner needs help with Spring + JPA + Transactions Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Beginner needs help with Spring + JPA + Transactions" Watch "Beginner needs help with Spring + JPA + Transactions" New topic
Author

Beginner needs help with Spring + JPA + Transactions

Julien Martin
Ranch Hand

Joined: Apr 24, 2004
Posts: 384
Hello,

I am new to spring and jpa and I cannot get the spring @Transactional annotation to work. My environment is as follows:
-Tomcat 6
-Spring wef flow + JSF
-JPA + Hibernate
-Spring RC1

Here is the content of my appcontext :


and here is my dao:



The method that calls the DAO:


And yet nothing is committed. I don't want to have programmatic commits in my app.

What am I getting wrong?

Julien.

PS. I searched the forum for an problem and environment similar to mine but to no avail.
Susanta Chatterjee
Ranch Hand

Joined: Aug 12, 2002
Posts: 102
Try changing your save method to:
Julien Martin
Ranch Hand

Joined: Apr 24, 2004
Posts: 384
No no. The whole point of using Spring is to have the automatic transaction demarcation with the @Transactional annotation. I don't want to do manual commits.... Any other idea?
J.
Edvins Reisons
Ranch Hand

Joined: Dec 11, 2006
Posts: 364
Julien,

if you believe that this question is about Spring (you may try to port the code to, say, EJB, to check this), there is an Application Frameworks forum on this site for discussions of Spring.
[ November 19, 2007: Message edited by: Edvins Reisons ]
Julien Martin
Ranch Hand

Joined: Apr 24, 2004
Posts: 384
Hello again,
I found the solution. I added this in my class:



Thanks again to all,

Julien.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Beginner needs help with Spring + JPA + Transactions