을 저장하는 동안 다음 코드org.hibernate.StaleObjectStateException : 도메인 클래스
studentInstance.addToAttempts(studentQuizInstance)
studentInstance.merge()
studentInstance.save(flush:true)
하고 위의 코드의 마지막 줄에 다음과 같은 예외를 throw는
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 명이이 코드를 동시에 호출 할 때만 발생하기 때문에 확실히 스레드 문제입니다.
나는 비슷한 상황에 처해있었습니다. studentInstance에서 호출하기 전에 studentQuizInstance에서 .merge()를 호출하면 어떻게됩니까? – marko
이 같은 상황에 대한 깔끔한 디버깅 트릭 몇 가지 있습니다 (이것은 날 비슷한 문제를 해결하는 데 도움이 생각) - http://stackoverflow.com/questions/536601/what-are-your-favorite-grails-debugging -tricks – marko