1
我的代碼有錯誤getTokenDAO().updateDate(newtok, new Date());
線彈出org.hibernate.HibernateException: No Session found for current thread
。請幫我解決這個問題。下面是我的編碼Java- TimerTask-org.hibernate.HibernateException:沒有找到當前線程的會話
Timer t = new Timer();
t.scheduleAtFixedRate(
new TimerTask() {
public void run() {
try {
getTokenDAO().updateDate(newtok, new Date());
} catch (Exception e) {
e.printStackTrace();
}
System.out.println("5 minutes passed");
}
},
0, // run first occurrence immediately
300000);
}
PS:我使用Spring