`

Hibernate:connection is not valid without active transaction 解决

阅读更多
Hibernate:connection is not valid without active transaction解决

用的是如下的这个方法:
Session session = new Configuration().configure().buildSessionFactory().getCurrentSession();
的getCurrentSession(); 方法;
只要换一个方法就行了。如下:
Session session = new Configuration().configure().buildSessionFactory().openSession();将getCurrentSession();方法换成openSession()方法就行了。
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics