org.hibernate.StaleStateException: Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1

前端 未结 14 1445
不思量自难忘°
不思量自难忘° 2021-01-01 10:56

I am using struts and hibernate. I have a parent and child relation using set in hbm. In the action I am using session.saveOrUpdate() method to save but while s

14条回答
  •  粉色の甜心
    2021-01-01 11:20

    It looks like, cargo can have one or more item. Each item would have a reference to its corresponding cargo.

    From the log, item object is inserted first and then an attempt is made to update the cargo object (which does not exist).

    I guess what you actually want is cargo object to be created first and then the item object to be created with the id of the cargo object as the reference - so, essentally re-look at the save() method in the Action class.

提交回复
热议问题