A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
EJB and other Java EE Technologies
Joined: May 15, 2008
Oct 19, 2008 20:26:00
I want to create a named query, which will return all the names which starts with "ABC", similar to the query below:
select * from customer where name like 'ABC%'
or, if i the
'ABC' is stored in a variable, than above query becomes:
select * from customer where name like name+'%'
I write a named query like this:
select c from customer c where name like :name
its working, but its not waht i want, when i changed the above named query to below:
select c from customer c where name like :name%
Above query gives exception. How to do such thing?
Joined: Nov 24, 2005
Oct 19, 2008 21:56:00
You don't want to append the '%' directly to the name variable, when calling setParameter ?
All roads lead to JavaRanch
Did you see how Paul
cut 87% off of his electric heat bill with 82 watts of micro heaters
subject: LIKE operator
urgent help reqd
Conditions for dependent entites on fetching?
How to do optional wildcard select in JPA named queries?
listing hibernate named queries from java
entity loading blues
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2013