Reputation: 31
I am running Hibernate 5 on EJB3 and wildfly 10 some requests fail on first Hibernate call with
org.hibernate.HibernateException: Current transaction is not in progress
when I am trying to call sessionFactory().getCurrentSession()
method.
(Using JTATransactionManager to manage transaction in hibernate.cfg.xml)
Upvotes: 3
Views: 6791
Reputation: 5828
That exception indicate that you're trying to get the current session no with available transaction. If you don't want to explicitly use .openSession().beginTransaction()
make sure that your transaction attribute is set to REQUIRED
or REQUIRES_NEW
.
Upvotes: 1