I recently started falling in love with the play! framework but now I am confused about how to use the batch delete method on a Model.
My attempt looks like this:
Shift.delete("byDateAndRestaurant", day, rest);
This, however, does not work. play! just throws this back at me:
IllegalArgumentException occured : org.hibernate.hql.ast.QuerySyntaxException: unexpected AST node: byDateAndRestaurant near line 1, column 41 [delete from models.Shift where byDateAndRestaurant]
which is very confusing as this code works flawlessly:
Shift.find("byDateAndRestaurant", day, rest).fetch();
(Of course, I could just loop through the results of the find query and delete each instance. But I don’t want to cause too many database interactions.)
So what kind of query/shortcut notation does the delete method accept?
should work fine.