DAO中要用getCurrentSession来获得session的话报No Session found for current thread
解决办法:
dao方法不要openSession,要获取当前session,不要关闭session:
Session session=sessionFactory.getCurrentSession()
dao只需要直接注入sessionFactory,不需要继承hibernatedaosupport之类的;
另外,需要service层一定要配置好声明事务!