HQL查询执行时间太长

时间:2014-05-07 11:23:21

标签: java sql hql

我有这个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))";

查询中涉及的所有属性都已建立索引......虽然执行时间超过一分钟..

0 个答案:

没有答案