Win a copy of Terraform in Action this week in the Cloud 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

problems with JDBC transaction in Spring

 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

I am trying to implement JDBC transaction through SPring AOP




What I expect this to do is, if , inside a method (matching the regular expression) I throw a DatabasePersistenceException (a RuntimeException in my case), I expect the JDBC insert/update/delete operations to be rolled back since the datasource object that I am doing JDBC operations on is same as the datasource object in my TransactionManager object. However this isnt working as intended. The JDBC operations arent being rolled back even if I throw the specified exception. I am doing the database operations using Spring's JdbcTemplate class.

Please suggest what I might be missing here.
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

rollback-for="DatabasePersistenceException".


Isn't DatabasePersistenceException in a package ?
 
ranger
Posts: 17346
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The JDBCTemplate does exception catching and transation to Spring's DataAccessExceptions. Try rollback for DataAccessException and see what happens and let us know.

THanks

Mark
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic