HibernateException: Could not obtain transaction-synchronized Session for current thread

After i update to spring4/hibernate4. i got above exception. Turns out that i need to add <tx:annotation-driven transaction-manager=”transactionManager”/> and @Transactional to my rest controller so that when the service/dao calls getCurrentSession(), spring could start the transaction and opens session from its own transaction management thru AOP.   If you encountered this when running unit test,…