Boa tarde a todos, estou tento um problema na persistência do detalhe no meu caso de uso. O erro que ocorre é o seguinte:
org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect): [br.gov.mg.dmae.webpremend.entidade.ImoveisPremendControleEntity#75]
Este erro só ocorre quando eu faço a chamada dos seguintes métodos:
public void atualizaFatorK1(){
ImoveisPremendControleEntity imovel = (ImoveisPremendControleEntity) entidadePlc;
List<?> imovelVa = imovel.getImoveisPremendVariacao();
Date dataAux = converteData("01/01/1901");
Date maiorDtK1 = maiorDtK1();
if(maiorDtK1 != dataAux){
for(int i = 0; i < imovelVa.size(); i++){
ImoveisPremendVariacaoEntity detalhe = (ImoveisPremendVariacaoEntity)imovelVa.get(i);
if(detalhe.getIdCoeficiente().trim().equalsIgnoreCase("k1")) {
if(detalhe.getDtFiscalizacao() == maiorDtK1){
Integer vrDqo = detalhe.getNrDqo();
Integer vrSst = detalhe.getNrSST();
BigDecimal vrFator = calculoVrFator1(vrDqo, vrSst);
imovel.setVrTaxaK1Aplicado(vrFator);
imovel.setDtAplicacaoK1(maiorDtK1());
}
}
}
}
}
//método para atualizar o valor do fator K2
public void atualizaFatorK2(){
ImoveisPremendControleEntity imovel = (ImoveisPremendControleEntity) entidadePlc;
List<?> imovelVa = imovel.getImoveisPremendVariacao();
Date dataAux = converteData("01/01/1901");
Date maiorDtK2 = maiorDtK2();
if(maiorDtK2 != dataAux){
for(int i = 0; i < imovelVa.size(); i++){
ImoveisPremendVariacaoEntity detalhe = (ImoveisPremendVariacaoEntity)imovelVa.get(i);
if(detalhe.getIdCoeficiente().trim().equalsIgnoreCase("k2")) {
if(detalhe.getDtFiscalizacao() == maiorDtK2()){
Integer vrDqo = detalhe.getNrDqo();
Integer vrSst = detalhe.getNrSST();
BigDecimal vrFator = calculoVrFator2(vrDqo, vrSst);
imovel.setVrTaxaK2Aplicado(vrFator);
imovel.setDtAplicacaoK2(maiorDtK2());
}
}
}
}
}
Alguem pode me dizer o que exatamente ocorre com este erro e me dizer como solucionar ou me direcionar como solucionar?
Desde já agradeço pela atenção.