樂觀鎖異常
????????session.save(classEntity);//級聯操作 /* ????????for?(StudentEntity?student:studentEntity){ ????????????session.save(student); ????????} */
只添加班級,系統通過級聯添加學生就會報錯javax.persistence.OptimisticLockException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect)
但是只保存學生,系統就會自動級聯保存班級這樣就是正常的,
有大佬清楚問題嗎?我代碼塊里只有一個session事務