• 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 ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Automatic database update and mail from java

 
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm developing a small web application for leave management system, where employees can apply and supervisors can approve / reject them and the same will be intimated by a mail. I have a requirement where all the leave requests that are older than a day should be approved automatically. Is there any way to do this from java side?

I use Java, JSF and Database is MySQL. Please help me. Thanks for your help.

 
Saloon Keeper
Posts: 28491
210
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can use a "cron task" to automatically rubberstamp requests that are older than 24 hours. On Unix/Linux systems, you can literally use the "cron" utility to run the mysql command-line processor and have it execute a SQL command. Windows also has a scheduler, although theirs is a little harder for most people to figure out.

Or, you can run an internal webapp process to do the same time, executing a JDBC request from Java Code. For something simple like this, you can just spawn a thread from an application contextListener to use the java Timer class. For more complex scheduling, a powerful alternative is the Quartz Scheduler.
 
Ranch Hand
Posts: 218
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

What app server are you using? the EJB timer service is something to consider if
it's supported in your environment. You mention the front end, the back end, but
omit any mention of anything in between.

Brendan.
 
reply
    Bookmark Topic Watch Topic
  • New Topic