org.hibernate.HibernateException : 주어진 식별자를 가진 하나 이상의 행이 발견되었습니다 : 클래스, com.hibernate.query.performance.persistence에 대해 578 그것은 0 레코드를 반환org.hibernate.HibernateException : 주어진 식별자를 가진 하나 이상의 행이 발견되었습니다
SELECT *
FROM store
WHERE store.store_id = 578;
: .model.Store
데이터베이스 그것은 SQL을 사용하여 확인 된 식별자 578와 중복 저장 행이 없습니다.
One, Two에 대한 다른 질문은 OneToOne 매핑 자체에 문제가 있음을 나타냅니다. 스토어 및 직원 단체는 OneToOne 관계를 가지고 나의 그 같은 매핑됩니다
직원 수 :
@OneToOne(mappedBy = "manager_staff", cascade = CascadeType.ALL, orphanRemoval = true)
public Store getStore() {
return store;
}
스토어 :
@OneToOne
@JoinColumn(name = "manager_staff_id", referencedColumnName = "staff_id", nullable = false)
public Staff getManager_staff() {
return manager_staff;
}
어떻게 그것을 해결하기 위해?
업데이트 :
예외는 쿼리로 수정 된 약간 변경 :
Query query = session.createQuery("select c " +
" from Rental r, Customer c join fetch c.address address join fetch address.store store join fetch address.city city " +
" where r.customer = c " +
" and r.returnDate is null");
예외 :
org.hibernate.HibernateException: More than one row with the given identifier was found: 2951, for class: com.hibernate.query.performance.persistence.model.Store
데이터베이스에 어떤 수정이 없었다. JProfiler가 JPA/Hibernate 레코드를 잡을 수 없으므로 HQL이 올바른지 확신 할 수 없습니다. 캐치되는 유일한 메트릭은 실행 된 JDBC 연결입니다.