-->
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.  [ 2 posts ] 
Author Message
 Post subject: Help with LIKE string contained in sql-query eg '%strgin%'
PostPosted: Thu Mar 03, 2005 2:11 pm 
Beginner
Beginner

Joined: Fri Oct 01, 2004 7:13 am
Posts: 20
Hibernate version:2.1.3

Currently have a sql-query using the LIKE keyword which appears to only search the beginning of the string as per 'string%' I have a sql-query but would like to search anywhere in the string.

My current query is :

<sql-query name="listSearch"><![CDATA[
select {u.*} from contactinfo c
inner join profiles p on c.id = p.id
WHERE LOWER(u.name) like :searchString
]]>
<return alias="u" class="com.lightning.persistent.User"/>
</sql-query>

Is there a support syntax in 2.1.3 to search anywhere within the string or will I have to drop out to sql for a '%string%' search?

Look forward to your responses.
Cheers


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 03, 2005 2:20 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
well, just do a setParameter("searchString", "%some%");


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.