I have schools, which contains groups, which contains students.
I would like to remove all students from specific school.
In SQL I can write the following query:
DELETE FROM students1
WHERE students1.group_id IN
(SELECT id FROM group1 WHERE group1.school_id = :school_id)
How to transform this SQL query to Hibernate HQL?
I use H2 database engine.
(My real query is more complex and simple cascade deletion of school is not suitable for me).
The working script follows:
Thanks to comments of doc_180