HibernateDAOFactoryクラスのLinkに基づいてDAOを実装しましたが、メソッドがあります
protected Session getCurrentSession() {
return HibernateUtil.getSessionFactory().getCurrentSession();
}
同じことを実装するために、以下の記事で 説明されているように、hibernate.cfg.xmlを変更しました。
<property name="transaction.factory_class">org.hibernate.transaction.JTATransactionFactory</property><br/>
<property name="transaction.manager_lookup_class">org.hibernate.transaction.JBossTransactionManagerLookup</property>
<property name="hibernate.current_session_context_class">thread</property>
jbossにデプロイしているときに、次のエラーが発生します
org.hibernate.TransactionException: could not register synchronization
プロパティも設定しました
<property name="hibernate.current_session_context_class">jta</property>
しかし、私は次のエラーが発生しました。
Caused by: org.hibernate.HibernateException: Unable to locate current JTA transaction
at org.hibernate.context.JTASessionContext.currentSession(JTASessionContext.java:88)
at org.hibernate.impl.SessionFactoryImpl.getCurrentSession(SessionFactoryImpl.java:574)
私はここで何かを逃していますか?私のjbossバージョンは4.2.3で、Hibernateバージョンは3.3.1で、Java7を使用しています。