我有这个HQL查询:
String hql = "from "+Patient.class.getName() + " p "
+ " where p.medicalRoom.id = "+medicalRoom.getId()
+ " and exists (select tg.id from "+TherapyGroup.class.getName()+" tg where tg.treatment.patient.id = p.id "
+ " and not exists (select ta.id from "+TherapyEnd.class.getName()+" ta where ta.therapyGroup.id = tg.id))";
查询中涉及的所有属性都已建立索引......虽然执行时间超过一分钟..