File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSF and the fly likes Automatic database update and mail from java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "Automatic database update and mail from java" Watch "Automatic database update and mail from java" New topic
Author

Automatic database update and mail from java

Dhamayanthi Karuppanan
Ranch Hand

Joined: Oct 20, 2009
Posts: 31
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

Joined: Jun 25, 2001
Posts: 16137
    
  21

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.


Customer surveys are for companies who didn't pay proper attention to begin with.
Brendan Healey
Ranch Hand

Joined: May 12, 2009
Posts: 218

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Automatic database update and mail from java