This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Building Blockchain Apps and have Michael Yuan on-line!
See this thread for details.
Win a copy of Building Blockchain Apps this week in the Cloud/Virtualization 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
  • Paul Clapham
  • Liutauras Vilda
  • Knute Snortum
  • Bear Bibeault
Sheriffs:
  • Devaka Cooray
  • Jeanne Boyarsky
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • salvin francis
Bartenders:
  • Tim Holloway
  • Piet Souris
  • Frits Walraven

problems with JDBC transaction in Spring

 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator

rollback-for="DatabasePersistenceException".


Isn't DatabasePersistenceException in a package ?
 
ranger
Posts: 17344
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
  • 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
 
Evil is afoot. But this tiny ad is just an ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!