多线程出现HibernateException: Could not obtain transaction-synchronized Session for current thread
使用hibernate4的SessionFactory获取Session时有两种方式1、sessionFactory.getCurrentSession()2、sessionFactory.openSession(),开启新session,需要关闭当使用1获取CurrentSession,不会开启新的session,速度很快。但是如果你是使用多线程的时候,就不能使用getCur
原创
2017-09-04 16:35:13 ·
4958 阅读 ·
3 评论