Spring and hibernate: No Session found for current thread

后端 未结 6 1497
生来不讨喜
生来不讨喜 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 11:47

    I solved the above problem by following two step

    1-Adding @Transactional support in my service method which is calling DAO methods

    2-By importing the applicationContext.xml in spring-servlet.xml in this way

     
    
    
    
    
        
    
    
        
    
    
    
    

    It removes the need to scan packages in two places spring-servlet.xml and applicationContext.xml

提交回复
热议问题