I am getting this exception when I call a DAO method which uses SessionFactory.getCurrentSession()
. The DAO class is annotated with @Transactional
after I add the property:
I get the exception like:
org.hibernate.HibernateException: createQuery is not valid without active transaction
org.hibernate.HibernateException: save is not valid without active transaction.
so I think setting that property is not a good solution.
finally I solve "No Hibernate Session bound to thread" problem :
1.
2.add
to servlet-context.xml or dispatcher-servlet.xml
3.add @Transactional after @Service and @Repository