spring和hibernate整合使用getCurrentSession()方法获得session实例时,一定记得在sessionFactory的bean中添加<prop key="hibernate.current_session_context_class">thread</prop>,如果你的事务时交给spring管理的,则就不要配置,不然就会报错:the save is not vali
问题描述:使用getHibernateTemplate().getSessionFactory().getCurrentSession()获取Session执行HSQL时,出现No Hibernate Session bound to thread, and configuration does not allow错误时。 使用Spring进行事务管理,相关的service事务配置没有生效。