Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Beginner needs help with Spring + JPA + Transactions

 
Julien Martin
Ranch Hand
Posts: 384
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 102
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try changing your save method to:
 
Julien Martin
Ranch Hand
Posts: 384
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 364
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 384
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello again,
I found the solution. I added this in my class:



Thanks again to all,

Julien.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic