I am working on simple web application using spring + hibernate + postgreSQL. I need to find out some way to let my app do an action on date and time saved in db. For example I have user birthdate record in DB and I want system to send an email to the user on his birthday. I've been thinking about letting timer thread to ask db every few minutes if there are date records matching to current date and time. But I have no experience with concurency in Java EE, so I am not sure if it is the right way. Or are there some other tools in spring and hibernate which could help me? I just need an advice on how to do this simply and gently to server.
Many thanks in advance.
It may still make sense to keep the code as part of the web app, though. In which case you could set up a Timer and a TimerTask in a ContextListener. But if you can easily separate it out into a cron job, I'd go for that.