我有以下查詢:對相關對象的關聯對象的HQL查詢條件爲
FROM PatientInfo AS pi WHERE pi.customerApplicationPatient.customerApplication.customerApplicationId = :customerApplicationId AND pi.customerAppPatient.patient.patientId = :patientId
PatientInfo,CustomerApplicationPatient關聯和customerApplicationPatientId是外鍵列。
CustomerApplicationPatient與CustomerApplication相關聯,Patient與customerApplicationId,patientId作爲foreignkey列。
問題:獲取給定customerApplicationId和PatientId的所有PatientInfo記錄。我的查詢在某種意義上是一個很好的查詢,不會產生太多的內部連接或交叉連接?有沒有更好的方法來做到這一點?
我真的很感謝任何幫助,並希望問題清楚。
感謝, 斯里蘭卡
您應該刪除'sql'標籤,因爲它不包含SQL。 – KingOfAllTrades 2014-09-04 21:22:41
@ user1290226請你指點我在上面的HQL查詢中的sql代碼。謝謝。 – Sri 2014-09-04 22:19:47