Hibernate Using In And Like Clause Together
I have the follow hibernate code, session.createQuery('from Car as car where car.keywordName like :keyword').setString('keyword', keyword ).list(); which takes in a keyword with
Solution 1:
You'll have to dynamically create a query to create something like
select car from Car car
where car.keywordName like :k1
or car.keywordName like :k2
or car.keywordName like :k3
...
The best tool to do that is the Criteria API (See the third code snippet, using a disjunction, for an example of a list of restrictions seperated with or).
Post a Comment for "Hibernate Using In And Like Clause Together"