3
テーブルの予定から外部キー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();
私が試してみましたので、同じよう
は私のAppointmentオブジェクトが私のPatientオブジェクトにマッピングされている(それはHQLのために重要かどうかを知りません) 「appt.appointmentId = 1」がうまく動作するため
createQuery("from Appointment as appt join appt.patientId ptid where ptid.patientId = 1").list();
私は根本的な何かが欠けする必要があります
:行うには、次のように参加します。どんな提案も感謝します。