Hibernate exception while saving with cascade=“save-update”

前端 未结 3 2002
梦如初夏
梦如初夏 2021-01-25 05:04

Here is my hbm and test code respectively. I am using Spring\'s HibernateTemplate. I doesn\'t use DAO. Hibernate 2.2.5 with Spring 2.0.7

hbm

<         


        
3条回答
  •  野性不改
    2021-01-25 05:12

    When you made a bidirectional relationship you need to put inverse=true otherwise hibernate is going to try to do a double access and that is why you are getting a exception. Hibernate needs to know which side of the relationship is the one who has the control of saving and updating.

提交回复
热议问题