데이터베이스에서 일부 데이터를 가져와 결과를 기반으로 한 번 더 쿼리를 실행해야합니다.봄/최대 절전 : org.hibernate.StaleStateException : 일괄 업데이트가 예기치 않게 반환되었습니다.
는하지만 예외 아래에 무엇입니까 :
org.hibernate.StaleStateException: Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1
내 코드 :
Session tempSession1 = HibernateUtil.getSessionFactory().openSession();
Session tempSession2 = HibernateUtil.getSessionFactory().openSession();
Criteria criteriaApplication = tempSession1.createCriteria(Entity.class);
try {
List list = criteriaApplication.add(Restrictions.eq("app__id",Entity.sys_id()).ignoreCase()).list();
tempSession1.flush();
tempSession1.close();
if (list.size() > 0) {
tempSession2.update(Entity);
tempSession2.flush();
tempSession2.close();
}
이 도와주세요. 누군가 내 코드를 수정할 수 있습니까?
수행하려는 작업을 명확하게 설명해 주시겠습니까? 'Entity '란 무엇이며 어디에 선언 되었습니까? 어떤 행에 예외가 발생합니까? – Petter