Java- TimerTask-org.hibernate.HibernateException: No Session found for current thread

My coding is having bug at getTokenDAO().updateDate(newtok, new Date()); line where it pops out org.hibernate.HibernateException: No Session found for current thread. Please help me to fix this problem. Here is my coding

Timer t = new Timer();
    new TimerTask() {
        public void run() {
            try {
                getTokenDAO().updateDate(newtok, new Date());
            } catch (Exception e) {
            System.out.println("5 minutes passed");
    0,      // run first occurrence immediately

PS: I am using Spring

The scheduler will run your TimerTask in a new thread. The session/transaction is saved in a ThreadLocal variable.

You will have to open a new transaction inside the run() method in your TimerTask.