我想在没有Spring的情况下使用Hibernate,我以这种方式设置Hiberante:
<property name="transaction.factory_class">org.hibernate.transaction.JDBCTransactionFactory</property>
<property name="hibernate.current_session_context_class">thread</property>
但现在我得到了这个例外:
org.hibernate.HibernateException: get is not valid without active transaction
有什么方法可以像Spring一样让Hibernate自动管理事务呢?我必须手动打开和关闭交易吗?
谢谢。