Search code examples
javahibernatequartz-scheduler

Real time Job Scheduling web application using Quartz with Hibernate


I am a beginner of Quartz.My requirement is something like this.I have already created java web application.there are some tasks stores in the Data base.To communicate with DB i use hibernate query language.There are plenty of jobs stores inside the DB table to be run.

job table

jobName runDate status

1.createUsers | 2015/5/13 1.30pm | schedule

2.UpdateUsers | 2015/5/13 10am | schedule

i want to implement a job listener for jobs and execute jobs when exact date come.I have gone through some articles available in internet but not much clear to me.I would like to know that how can i run a job listener time to time that check whether job is ready to execute if ready that will fetch data using HQL and run jobs. Appreciate your ideas.


Solution

  • I have finally found a good article that let us know how to do curd operations using quartz in dynamically.The above posted answers are also fine but the problem is that all jobs creation and execution in a static way.but my requirement was that jobs should be created in dynamic way.This article will help you to get some idea about how we can create execute delete jobs in run time.All credits go to article author :).I shared this because of lot of peoples looking for that kind of thing but the article is not much popular.here is the steps i have followed.

    1. Create a database for store the job details.

      The reason was for that every time we restart the server our jobs wont be discard.

    2. Fetch stored jobs from DB and assign each job to a quartz Job scheduler.

    3. Configure Spring frame work to contiguously execute the PersistentJobSchedulerJob class.

      Hope this will help for someone.