| Author |
How do I do a 'like' with a numeric value using entities?
|
Max Tomlinson
Ranch Hand
Joined: Jul 17, 2001
Posts: 364
|
|
Hi all - I want to use a like clause with a long e.g. where id like '123%' .... using Hibernate's query.setParameter I run into a problem: query.setParameter( id, "123%") complains because the value is a long and I'm passing a String do I need to code a native query? thanks Max
|
 |
Jason Kwok
Ranch Hand
Joined: Mar 31, 2005
Posts: 126
|
|
This is a HUGE stab in the dark because I haven't used Hibernate before and as such, I may be completely off base here, but this looks similar to using a PreparedStatement which I've used to work with MySQL. Try this: ... where ((id) Like ?) query.setParameter(1, "123%"); [ July 06, 2007: Message edited by: Jason Kwok ]
|
 |
Max Tomlinson
Ranch Hand
Joined: Jul 17, 2001
Posts: 364
|
|
|
I tried that but it complains because the parm is a String, not a Long...native sql works because soem conversion is done from the '123%'..
|
 |
 |
|
|
subject: How do I do a 'like' with a numeric value using entities?
|
|
|