currentsessioncontext专题

错误:org.hibernate.HibernateException: No CurrentSessionContext configured!

版本:Hibernate_Core 3.3.2 在使用3.2的时候获取Session习惯使用sf.openSession(); 但是现在开始流行getCurrentSession();了,原因很简单,openSession()是不管任何情况都重新开启一个Session,而getCurrentSession();相对的增加了一个判断,在有Session的情况下就会直接去调用,没有sessio