Getting Transaction not successfully started exception using Spring Hibernate

前端 未结 2 2114
囚心锁ツ
囚心锁ツ 2021-02-10 05:06

I have a UserProfile entity which I need to save. after saving the entity in the database, I get the following exception:

Could not commit Hibernate transaction;         


        
2条回答
  •  北海茫月
    2021-02-10 05:49

    Could also be a conflict between org.springframework.orm.hibernate3.HibernateTemplate and org.hibernate.Session.

    If you are working on an old project you could find HibernateTemplate being used.

    If you create a new DAO with a newer way of doing things, like hibernate's Session, and use both DAOs on the same function, you will find this error.

    Solution: Use one or the other. In my case I had to use HibernateTemplate in order not to change all ther rest of an old program.

提交回复
热议问题