在配置文件中已经默认开启了本地Session 但还是爆了 org.hibernate.HibernateException: get is not valid without active transaction 的错误
错误原因:
使用SessionFactory的getCurrentSession获取本地Session,未开启事务就使用Session
解决办法:
不管是查询还是修改都开启事务在进行。
在配置文件中已经默认开启了本地Session 但还是爆了 org.hibernate.HibernateException: get is not valid without active transaction 的错误
使用SessionFactory的getCurrentSession获取本地Session,未开启事务就使用Session
不管是查询还是修改都开启事务在进行。