In a legacy project I need the SessionFactory.
My persistence.xml:
<persistence-unit name="User">
<jta-data-source>java:/OracleDS</jta-data-source>
<exclude-unlisted-classes>true</exclude-unlisted-classes>
<properties>
<property name="hibernate.ejb.cfgfile" value="/user/hibernate.cfg.xml" />
<property name="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect" />
<property name="hibernate.transaction.factory_class"
value="org.hibernate.transaction.JTATransactionFactory" />
<property name="hibernate.transaction.manager_lookup_class"
value="org.hibernate.transaction.JBossTransactionManagerLookup" />
<property name="hibernate.current_session_context_class"
value="jta" />
<property name="hibernate.session_factory_name" value="java:/hibernate/UserSessionFactory" />
</properties>
</persistence-unit>
In the EJB3 I use it like this:
@Resource(mappedName = "java:/hibernate/UserSessionFactory")
private SessionFactory sf;
private Session getSession() {
return sf.openSession();
}
But it seems that there is no transaction active as there are no update statements generated.
What's wrong?