Win a copy of Zero to AI - A non-technical, hype-free guide to prospering in the AI era this week in the Artificial Intelligence and Machine Learning 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 ...
  • Campbell Ritchie
  • Liutauras Vilda
  • Paul Clapham
  • Bear Bibeault
  • Jeanne Boyarsky
  • Ron McLeod
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
  • Carey Brown
  • salvin francis
  • Scott Selikoff
  • fred rosenberger

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

Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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.

That's my roommate. He's kinda weird, but he always pays his half of the rent. And he gave me this tiny ad:
Thread Boost feature
    Bookmark Topic Watch Topic
  • New Topic