Geniedesalpages
Geniedesalpages

Reputation: 418

Hibernate Criteria Restrictions.in combined with ilike

Is there a way to combine the

Restrictions.in(String, Collection<String>)

with

Restrictions.ilike(String, String)

The goal would be to provide a list of possible matches (like in) but to compare them with the ilike operator instead of a hard compare.

Is this possible?

Upvotes: 1

Views: 1577

Answers (1)

Ralph
Ralph

Reputation: 120841

You could build it by your own with the help of org.hibernate.criterion.Disjunction.

Disjunction or = Restrictions.disjunction();
or.add(Restrictions.ilike(String, String));
or.add(Restrictions.ilike(String, String));
or.add(Restrictions.ilike(String, String));

Upvotes: 6

Related Questions