@Transactional in Spring+Hibernate

后端 未结 3 1556
轮回少年
轮回少年 2021-01-02 11:49

I an using Spring 3.1 + Hibernate 4.x in my web application. In my DAO, i am saving User type object as following

sessionFactory.getCurren         


        
3条回答
  •  时光取名叫无心
    2021-01-02 12:26

    Using your working version of the Spring XML, and the @Transactional annotated DAO class, are you defining the DAO in your Spring XML ? (Perhaps as a prototype) Because if you're not, then so far as I can see, your DAO is not going to be AOP'ed for transactional aspects. I think that's the easiest way. This example is from the Spring 3 Doc, section 10.5.6 Using @Transactional.

      
      
    
      
      
    

    ...where you might substitute DefaultFooService for your DAO.

提交回复
热议问题