wood burning stoves 2.0*
The moose likes Spring and the fly likes rollback for checked exceptions  as default Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "rollback for checked exceptions  as default" Watch "rollback for checked exceptions  as default" New topic
Author

rollback for checked exceptions as default

srini carry
Ranch Hand

Joined: Nov 30, 2007
Posts: 83


can I specify rollback for any exception checked or unchecked as default , I know by default it is only for unchecked exceptions , in my case even for checked exceptions I want rollback can I do that ?
Eduardo Bueno
Ranch Hand

Joined: Jun 04, 2009
Posts: 155
Yes, you can. As checked exceptions inherit from Exception class, rollbackFor=Exception.class works perfectly.
srini carry
Ranch Hand

Joined: Nov 30, 2007
Posts: 83
Eduardo Bueno wrote:Yes, you can. As checked exceptions inherit from Exception class, rollbackFor=Exception.class works perfectly.


that works but I have to specify that on each method can I do that globally or set that as default ?
Eduardo Bueno
Ranch Hand

Joined: Jun 04, 2009
Posts: 155
You can define the methods by name via a TransactionAttributeSource.
 
jQuery in Action, 2nd edition
 
subject: rollback for checked exceptions as default
 
Similar Threads
Problem using @Transactional with jtaTransactionManager
Use of Checked and Unchecked Exception
Exception
Application Exceptions...
Exceptions