Win a copy of Programmers Guide to Apache Thrift this week in the Open Source forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

Transaction is not rolling back  RSS feed

 
Ranch Hand
Posts: 349
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
I am using spring declarative transaction by using annotation.
When am forcefully calling the Exception on saveStock() ,,, the rollback is not working .
Here are my code snippet :

In the PersonDAO class




My PersonDao class is somthing like this :



The Stock and Person data are getting saved in the DB.
Here is the output :



Any pointer on this would be appreciable..

Thanks ,
Satya
 
S Majumder
Ranch Hand
Posts: 349
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Solved the problem
I was making few mistakes ..
1) Need to call saveStock() and savePerson() from different service class .
2)I was creating the target object by spring's JDK dynamic proxies ( implemented by its interfaces) , changed that to CGLIB to create the proxy for that target object . By



And CGLIB dependency jar in the classpath

An my app running as expected !!!

Must read Proxying mechanisms

Satya
 
Liar, liar, pants on fire! refreshing plug:
ScroogeXHTML - small and flexible RTF to HTML converter library
https://coderanch.com/t/710903/ScroogeXHTML-RTF-HTML-XHTML-converter
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!