aspose file tools*
The moose likes Spring and the fly likes Problem using @Transactional with jtaTransactionManager Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "Problem using @Transactional with jtaTransactionManager" Watch "Problem using @Transactional with jtaTransactionManager" New topic
Author

Problem using @Transactional with jtaTransactionManager

Kuldeep Tewari
Ranch Hand

Joined: May 22, 2006
Posts: 35
Hi Ranchers,

I'm writing code to schedule sending emails to users with different frequencies, using Spring and Quartz. In my code, I first save the data related to email(to, from, content etc details) in a database table and then I save the scheduling frequency information in quartz tables. here is the method:


This is how I set JTATransactionManager in spring config:

I thought that if the statement fails then the data entered by the statement should be rolled back, but it doesn't.

Please tell where i'm making a mistake.

Thanks in advance.
Kuldeep Tewari
Ranch Hand

Joined: May 22, 2006
Posts: 35
I found the answer:

By default, the rollback is done only for runtime exceptions and not when a checked exception is thrown. I set the element "rollbackFor=Exception.class" with the @Transactional and now rollback happens for all exceptions.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem using @Transactional with jtaTransactionManager
 
Similar Threads
does Spring handle JTA kind stuff ?
org.springframework.batch.core.repository.JobExecutionAlreadyRunningException
Quartz Scheduler that runs every x months
send email using spring + Quartz Scheduler
Managing hibernate transactions involving sessions from multiple sessionFactories