Searching for "Quartz Hibernate" returned this. Coming to a different solution (and using Tapestry), I thought I'd share it.
when scheduling the Job:
…
Scheduler scheduler = StdSchedulerFactory.getDefaultScheduler();
JobDataMap myJobDataMap = new JobDataMap();
myJobDataMap.put("HibernateSessionManager", hibernateSessionManager);
myJobDataMap.put("PerthreadManager", perThreadManager);
JobDetail job = JobBuilder.newJob(SomeJob.class).withIdentity(
"SomeJob", "someGroup").setJobData(
myJobDataMap).build();
Trigger trigger = TriggerBuilder.newTrigger().withIdentity(
"Some Trigger", "someGroup").startNow().withSchedule(
SimpleScheduleBuilder.repeatSecondlyForever(30)).build();
scheduler.scheduleJob(job, trigger);
scheduler.start();
…
and in the Job
public void execute(JobExecutionContext context)
throws JobExecutionException
{
JobDataMap jdm = context.getMergedJobDataMap();
HibernateSessionManager hibernateSessionManager = (HibernateSessionManager) jdm.get("HibernateSessionManager");
PerthreadManager perThreadManager = (PerthreadManager) jdm.get("PerthreadManager");
Session session = hibernateSessionManager.getSession();
//do stuff with session …
//now clean up, otherwise I ended up with <IDLE> in transactions
perThreadManager.cleanUp();
}
Hope somebody can use this.