Answer the question
In order to leave comments, you need to log in
How to get records in hibernate whose id is equal to the values from the array?
How to get records in hibernate whose id is equal to the values from the array?
this is how you can get a specific record: criteria.add(Restrictions.eq("id", id));
for example, I have an array, and I could do it like this:
int []mas= {1, 2, 3, 4, 5, 6};
criteria.add(Restrictions.eq("id", mas));
Answer the question
In order to leave comments, you need to log in
Use Restrictions.in() instead of Restrictions.eq()criteria.add(Restrictions.in("id", mas));
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question