0

次のコードがあります

studentInstance.addToAttempts(studentQuizInstance)
studentInstance.merge()
studentInstance.save(flush:true)

そして、上記のコードの最後の行で次の例外をスローします

org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect): [com.easytha.Quiz#1]

私は同じ問題について議論しているいくつかのスレッドを見てきstudentInstance.withTransactionましstudentInstance.withTransactionた.

20 ~ 30 人のユーザーがこのコードを同時に呼び出した場合にのみ発生するため、これは間違いなくスレッドの問題です。

4

1 に答える 1