Reputation: 33
I need a HQL or JPQL for the following query:
select * from customer where customer_name like '%ROB%'
I am using Query Manager for JPQL queries.
Upvotes: 1
Views: 3133
Reputation: 38958
http://www.stpe.se/2008/07/hibernate-hql-like-query-named-parameters/ says you should include the %
symbol in the parameter itself, not the query.
e.g.:
String query = "from user u where u.name like :name"
getHibernateTemplate().findByNamedParam(query, "name", '%' + str + '%');
Upvotes: 1