Deleting some data as a periodic/scheduling job In Java
I am working in Java project with Spring and Hibernate framework. The database used is Oracle and application server is JBoss 4 and OS is Unix.
I have to write a logic that will delete the data from all the tables older than 180 days.There is a date column in a particular table using which I have to determine if it is older than 180 days or not. if it is I will have to delete all rows from that table and any associated row from any other table as well.I can use hibernate to delete such data from the tables.
This functionality will be scheduled i.e. the delete logic will be called at some periodic time may be daily at 3:00 p.m., exact time client will inform me soon.This logic has to be separated from the application war that I usually make of my actual project source code.
I don't have any issue in writing the persistence related code that will delete the data but I am confused about how to put this logic separately in JBoss. Shall I make jar of the code and put that in JBoss? And also how will the delete logic be called? Do I need to configure/write some scheduler that will do this job?
Can somebody please help me with this?
Have a look at Quartz. It's a relatively easy to use scheduler for Java. You should be able to get this up and running very quickly.