File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Automatic database update and mail from java

 
Dhamayanthi Karuppanan
Ranch Hand
Posts: 31
  • 0
  • Mark post as helpful
  • send pies
  • 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.

 
Tim Holloway
Saloon Keeper
Pie
Posts: 17618
39
Android Eclipse IDE Linux
  • 0
  • Mark post as helpful
  • send pies
  • 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.
 
Brendan Healey
Ranch Hand
Posts: 218
  • 0
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic