• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Beginner needs help with Spring + JPA + Transactions

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



Thanks again to all,

Julien.
 
Put a gun against his head, pulled my trigger, now he's dead, that tiny ad sure bled
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic