I have migrated Spring from 3.1 to 4.1.3 and Hibernate 3.2 to 4.3.9
As part of migration I have modified below import and code
old import
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
new Import
import org.springframework.orm.hibernate4.support.HibernateDaoSupport;
and code changes
In hibernate 3 I have following code
public Session getCurrentSession() {
Session session = getSession();
session.setFlushMode(FlushMode.MANUAL);
return session;
}
now I have modified according to new jars as below
public Session getCurrentSession() {
Session session = currentSession();
session.setFlushMode(FlushMode.MANUAL);
return session;
}
after the above changes I am getting below exception
Could not obtain transaction-synchronized Session for current thread
org.hibernate.HibernateException: Could not obtain transaction-synchronized Session for current thread
at org.springframework.orm.hibernate4.SpringSessionContext.currentSession(SpringSessionContext.java:134)
at org.hibernate.internal.SessionFactoryImpl.getCurrentSession(SessionFactoryImpl.java:1014)
at org.springframework.orm.hibernate4.support.HibernateDaoSupport.currentSession(HibernateDaoSupport.java:129)
I am not using annotations in my application
I am not able to resolve the issue. Please help me in knowing possible reasons for the exception