I know that the recommendation is "Use Named Queries", and a lot of the times that is a good answer, but in some cases (for instance this one), a prep query is really the better tool for the job.
Imagine a user selects 10 rows for deletion, do you really want to run 10 quries against the database when you can just run 1?
What about if 5 different users select 2 rows? or 5 rows.
You should really loop through the selected rows gathering all of the ids, and then run a single query.
Just like @pascal.fragnoud showed you here: