Win a copy of Java 9 Revealed this week in the Features new in Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Hibernate: IN clause when deleting  RSS feed

Antonio Fornie
Ranch Hand
Posts: 117
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I have an entity User:

public class User{
int id;
protected String name;

I'd like to delete some users from a list of ids (List<Integer>), so I tried to use the IN clause but ot didn't work. Neither I could use a Criteria. So what I did was to use the Criteria to make a select an then delete all of them with that resultset:


Isn't there a better way to do it? Can't I avoid that select and use directly a delete?

Thank you very much.

  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!