I need to transform this SQL statement HQL but I think the NOT EXISTS not working in HQL Please help me!!!
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