0
我需要轉換此SQL語句HQL,但我認爲不存在不在HQL中工作 請幫助我!使用標準和不存在將SQL轉換爲HQL
SELECT doctor.idUser, schedule.idSchedule, schedule.timeStart, schedule.day
FROM doctor, schedule
WHERE schedule.day='LUNES'
AND schedule.timeStart > '08:00:00'
AND doctor.idUser= '1'
AND doctor.idUser = schedule.idUserDoctor
AND NOT EXISTS(SELECT * FROM appointment
WHERE schedule.idSchedule = appointment.idSchedule
AND doctor.idUser = schedule.idUserDoctor
AND appointment.appointmentDate ='2012-09-06')
AND NOT EXISTS (SELECT * FROM temporaryschedule
WHERE schedule.idSchedule = temporaryschedule.idSchedule
AND doctor.idUser = schedule.idUserDoctor"
AND temporaryschedule.appointmentDate='201-09-06')
ORDER BY schedule.timeStart ASC
關於'不EXISTS'這個[問題](http://stackoverflow.com/questions/3672444/where-exists-in- hibernate-hql)可能會有所幫助。你將不得不從你的'NOT EXISTS'子句中單獨確定對象(或它們的ID),並像這樣插入它們:'AND doctor.idUser NOT IN(1,2,3)'。 – Pao