getSession() –> the java doc says it will create a new session/ continue with the existing one based on getHibernateTemplate().setAllowCreate(…); set to true/ false.
How ever, i found the things to be diffarent. I had a 2 DAOs one executing: getHibernateTemplate().find(..); the other using getSession().createCriteria(..); They are wrapped by the same transaction interceptor. What i found is when the 2nd DAO runs the hibernate throws illegal state exception.
Why?? The getSession() always tries to crate a new session, if the setAllowCreate is set to false, then it throws illegal argument exception. Why this devaiation??? as always only god knows it.
To get the current session in 2nd DAO, i found the fix: getHibernateTemplate().getSessionFactory().getCurrentSession(); and things went off very fine.