m-2127
m-2127

Reputation: 161

Periodically update the values in the database using spring boot

I am working on a leave management system where the employees leave quota includes the number of leaves of each leave type(eg: annual, sick) that the employees can obtain each year. I need the leave quota of each employee to be updated to the original value(fixed amount of leave each employee is eligible for) at the beginning of every year. How can I implement this using spring boot and mysql as the database.

Upvotes: 1

Views: 1403

Answers (2)

Mohamed Sweelam
Mohamed Sweelam

Reputation: 1219

If you’re looking for automatic process, you can use Spring scheduler with cron job. Check this https://spring.io/guides/gs/scheduling-tasks/

Upvotes: 1

O. Jones
O. Jones

Reputation: 108841

Many applications like yours have end-of-year programs. Someone in your HR / accounting / finance department runs them as part of the task of closing the previous year's books and opening the new year's.

Your quota-reset function belongs there. Your kind of system may also have end of quarter, end of month, and / or end-of-week programs.

How do you implement these programs? The same way as you implement other data-handling programs. If your system is a web app, its administrator page will contain a "close last year, start new year" button.

For safety, it's probably best to prompt a user who presses the button like this.

"Are you sure you want to close calendar year 2019 and open calendar year 2020? You cannot undo this. To proceed, please re-enter your password."

Upvotes: 0

Related Questions