최대 절전 모드에서 spring orm을 사용하고 있습니다. 다음과 같은 방법이 있습니다.낙관적 인 버전 잠금
개체에 버전 열 @ 버전이 있습니다.
void processObject(){
Object obj = getObjectFromDB(int id);
//do lot of processing. Takes 15 min
//version number is not changed
//if some other object updates the same object , which
//exception is thrown when folloing code runs
updateObject(obj) ;
//
}
@Transactional
updateObject(Object object){
session.save(object)
}
@Transcational
Object getObjectFromDB(int id){
}
이제 개체를 처리하고 저장하는 동안 다른 스레드가 개체를 업데이트하면 어떤 예외가 발생합니까?
1)StaleStateException (hibernate)
2)StaleObjectstateException (hibernate)
3)ConcurrentFailureException (spring)
4)Any other?
읽어 보시겠습니까? –