This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Other Application Frameworks and the fly likes How to get a quartz job to use a hibernate transaction session Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Other Application Frameworks
Bookmark "How to get a quartz job to use a hibernate transaction session" Watch "How to get a quartz job to use a hibernate transaction session" New topic
Author

How to get a quartz job to use a hibernate transaction session

Som Bhattacharyya
Greenhorn

Joined: Dec 11, 2010
Posts: 5
Hi,

i have run into a implementation issue.
Please review the following scenario ,

i have a testService class that is configured as a Spring bean in application context.
This class is configured as a transaction proxy in the app context and wraps a target java class(defaultservicetarget) that generates quartz jobs depending on inputs received from the user.
The target class(defaultservicetarget) actually can perform the dB calls as it is configured as a transactionproxyfactory bean(testService) in the app context.

So inside a method of the target class(defaultservicetarget) i get a quartz scheduler and generate jobdetails and trigger according to the user choice. The trigger used is a simple trigger. And i schedule a job(delayJob.class) accordingly.

i use a job class(delayJob) created by implementing the job interface. i want to execute some database communication inside the job class for processing and perform some steps according to that.

Now when the target class method(defaultservicetarget) executes and scheduled job(s) are created ie. the control enters the "execute" method of the job class(delayJob) i am no longer able to use the persistence context that was being used by the caller target class and get a "invocation exception".

So basically i need to have the hibernate transaction context inside the "job" class as well so that i can carry out the dB transactions.

i cannot use the concept of spring managed quartz ser vices because i would need to configure the triggers and everything as beans. But i have the trigger intervals that are dynamic and cannot be injected beforehand.

Help will be highly appreciated. i have been stuck with this for three days now.

Thanks,
Som
 
 
subject: How to get a quartz job to use a hibernate transaction session
 
Similar Threads
Quartz Reschduling issue
Need help on Spring - Quartz Job deployment in Jboss server
Passed SCBCD 5.0 :)
org.springframework.batch.core.repository.JobExecutionAlreadyRunningException
question Quartz with Hibernate