No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional one here

前端 未结 9 775
情歌与酒
情歌与酒 2020-12-23 17:03

I am getting this exception when I call a DAO method which uses SessionFactory.getCurrentSession(). The DAO class is annotated with @Transactional

9条回答
  •  被撕碎了的回忆
    2020-12-23 17:52

    Whenever you will face below error just follow it.

    org.hibernate.HibernateException: No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional one here at org.springframework.orm.hibernate3.SpringSessionContext.currentSession(SpringSessionContext.java:63)

    Put a @Transactional annotation for each method of implementing classes.

提交回复
热议问题