openSession和getCurrentSession之间的区别

来源:互联网 发布:手机淘宝登入卖家 编辑:程序博客网 时间:2024/06/06 18:18

1.getCurrentSession在事务提交或者回滚后会自动关闭,而openSession需要你手动关闭。如果使用openSession而没有手动关闭,多次使用之后,会导致连接池溢出。

2.openSession每次会创建新的Session对象,getCurrnetSession使用现有的Session对象。


0 0
原创粉丝点击