I am working on a Spring-MVC project with Hibernate and DB as Postgres in which there is a possibility to assign tasks to individual people who are part of a group.
Now the tasks have end-time, and I have a scheduler running which every 30 minutes would check if task has around 48hours remaining to finish, if that's the case, then I would send an email.
Unfortunately, I cannot just check for less than 48 hours, as I am also checking for less then 12 hours and less then 8hours.
So, I thought why not to check that the time remaining is between 47-48hours. And I don't know how to check such a condition.
So, basically, from the current time, if the row has a timestamp which is 47-48hours far away, I want to retrieve that row. I know how to check for more then what is now, and below is the code. Can anyone help me how to check within 47-48hours. Thanks a lot.
Code :
@Override
public List<GroupNotes> findGroupNotesWithExpiryInFortyEightHours() {
int val = 0;
Session session = this.sessionFactory.getCurrentSession();
Timestamp timestamp = new Timestamp(System.currentTimeMillis());
Query query = session.createQuery("from GroupNotes as gn where gn.zugwisenPersonId!=:val and gn.timeToend>:timestamp");
}
Thanks a lot.