0
結果を得るために3つのテーブルを結合するクエリがありますが、オブジェクトがnullになることがあります。この場合、結合を避ける必要があります。 PatientRemindersTO上記patientTO.patientId詳細にオブジェクトがnullでない場合のみ、Hibernate結合
Criteria patientCriteria = session.createCriteria(PatientRemindersTO.class);
patientCriteria.createAlias("patientTO", "patientTO");
patientCriteria.createAlias("doctorTO", "doctorTO");
patientCriteria.setProjection(Projections.distinct(Projections.projectionList()
.add(Projections.property("patientRemindersId"))
.add(Projections.property("doctorTO.doctorId"))
.add(Projections.property("doctorTO.phoneNumber"))
.add(Projections.property("patientTO.patientId"))
.add(Projections.property("patientTO.Mobile"))
.add(Projections.property("reminderSettingsType"))
));
DetachedCriteria fcCriteria = DetachedCriteria.forClass(PatientRemindersScheduleTO.class,"patientRemindersScheduleTO");
fcCriteria.add(Restrictions.eq("patientReminderScheduleActive",'Y'));
fcCriteria.setProjection(Projections.property("patientRemindersScheduleTO.patientRemindersId"));
patientCriteria.add(Subqueries.propertyIn("patientRemindersId", fcCriteria));
List results = patientCriteria.list();
nullにすることができます。したがって、結果は返されません。エイリアスを作成する前にヌルチェックを実行する方法はありますか?
あなたの貴重な時間をありがとう。