2
這是一個Q & A-樣式。爲什麼數據庫調用在一些有限的調用後睡眠
使用SessionFactoryUtils.getSession獲取會話並執行我的查詢時,它可以只調用有限的計數,並在調用此限制計數後等待。 爲什麼會發生?
try {
SessionFactory sessionFactory = getHibernateTemplate().getSessionFactory();
Session session = SessionFactoryUtils.getSession(sessionFactory, true);
Query query = session.getNamedQuery("updateAField");
query.setParameterList("states", states);
int updatedCount = query.executeUpdate();
return updatedCount;
} catch (Exception e) {
logger.error(e.toString());
throw new Throwable(e);
}
你自己回答這個問題嗎? – ChriWeis 2012-08-13 08:55:01
是的,這是一個問答風格 – mirzaei 2012-08-13 08:55:57