3
테이블 약속에서 foreign 키 patientId를 쿼리하려고합니다.Hibernate hql - 외래 키 질의 도움말
<many-to-one name="patient" class="application.model.Patient" fetch="select">
<column name="patientId" not-null="true" />
</many-to-one>
내 쿼리는 다음과 같습니다 :
createQuery("from Appointment as appt where appt.patientId = 1").list();
나는 시도과 같이
내 약속 개체가 내 환자 개체에 매핑되는(는 HQL에 대한 중요한 알고하지 않습니다) 같은 조인을 :
createQuery("from Appointment as appt join appt.patientId ptid where ptid.patientId = 1").list();
"appt.appointmentId = 1"잘 작동하기 때문에 나는 뭔가를 놓치고 있어야합니다. . 모든 제안을 주시면 감사하겠습니다.