原文:SessionFactory.getCurrentSession与openSession的区别(转)

SessionFactory.getCurrentSession与openSession的区别 .如果使用的是getCurrentSession来创建session的话,在commit后,session就自动被关闭了, 也就是不用再session.close 了。但是如果使用的是openSession方法创建的session的话, 那么必须显示的关闭session,也就是调用session.clo ...

2013-10-23 10:01 0 2569 推荐指数:

查看详情

Hibernate openSession() 和 getCurrentSession区别 .

Hibernate openSession() 和 getCurrentSession区别 getHiberanteTemplate 、getCurrentSessionOpenSession 采用getCurrentSession()创建的Session会绑定到当前的线程中去、而采用 ...

Fri Feb 10 03:10:00 CST 2012 0 9557
openSessiongetCurrentSession区别

1、openSession 每一次获得的是一个全新的session对象,而getCurrentSession获得的是与当前线程绑定的session对象 package cn.kiwifly.view; import org.hibernate.SessionFactory; import ...

Sun Dec 07 18:05:00 CST 2014 1 2590
 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM