• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
  • Mikalai Zaikin

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

Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.

    Bookmark Topic Watch Topic
  • New Topic