I was trying to configure spring 3.1 and hibernate. I have written a simple test project. where I have user domain and userDao and its implementation
let me show yo
There are no transactions in your sample project. Add:
And annotate your DAO with @Transactional:
@Transactional
@Repository
public class UserDaoImpl implements UserDao
Two notes:
you are correctly marking your DAO with @Repository, but it only handles exception translation:
A class thus annotated is eligible for Spring DataAccessException translation
consider placing @Transactional on higher level classes (@Services), see What is the right way to use spring MVC with Hibernate in DAO, sevice layer architecture for discussion