关于: No Hibernate Session bound to thread, and configuration does not allow creation of non-transacti
今天写项目的时候遇到一个小bug,由于天气太热,有点浮躁,所以开始找不到问题,最后平静心态,按提示寻源头,终于找到了节点所在,现在分享给大家:
该异常是获取session的时候报错的。我用的是getCurrentSession()来获取session。但明显获取不到;网上查了一下:
用openSession()最后需要close掉;
用getCurrentSession()需要套
原创
2016-06-23 19:51:42 ·
602 阅读 ·
0 评论