Spring and hibernate: No Session found for current thread

后端 未结 6 1496
生来不讨喜
生来不讨喜 2020-11-28 11:05

im gettting the following error

org.hibernate.HibernateException: No Session found for current thread
at org.springframework.orm.hibernate4.SpringSessionCont         


        
6条回答
  •  自闭症患者
    2020-11-28 12:00

    change your DAO 's annotation with @Repository

    @Repository
    public class ProfileDao { 
    .
    .
    .
    }
    

    and then make your service method @Transactional for example like this

    @Transactional
    public List getRetailerByRetailerNumber(String retailerNo) {}
    

提交回复
热议问题