-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: Using an SQL "LIKE" Command
PostPosted: Thu May 20, 2004 1:29 am 
Beginner
Beginner

Joined: Tue May 11, 2004 10:21 am
Posts: 20
I would like to do the equivilent of a "LIKE" command with the % % around my variable. Is their a way to do this with Hibernates command language?

I tried to google this ? with no results.

TIA

Tom K.


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 20, 2004 5:19 am 
Hibernate Team
Hibernate Team

Joined: Thu Dec 18, 2003 9:55 am
Posts: 1977
Location: France
you can use it

for example
Code:
from test where test.name like :criteria


this example uses a named parameter, read the doc to know about it, in your case :
criteria = "%xxxx%";

Anthony


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 20, 2004 5:21 am 
Beginner
Beginner

Joined: Fri Apr 02, 2004 1:20 pm
Posts: 23
Try this:

where column like ('%' || :bindVariable || '%')


Top
 Profile  
 
 Post subject: Thanks
PostPosted: Thu May 20, 2004 9:30 am 
Beginner
Beginner

Joined: Tue May 11, 2004 10:21 am
Posts: 20
Thanks!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.