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

前端 未结 14 1458
不思量自难忘°
不思量自难忘° 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:28

    It looks like, when you try to delete the same object and then again update the same object, then it gives you this error. As after every update hibernate for safe checking fires how many rows were updated, but during the code the data must have been deleted. Over here hibernate distinguish between the objects based on the key what u have assigned or the equals method.

    so, just go through once through your code for this check, or try with implementing equals & hashcode method correctly which might help.

提交回复
热议问题