-->
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: using named Parameter and like
PostPosted: Tue May 18, 2004 3:24 pm 
Newbie

Joined: Fri Apr 02, 2004 4:12 pm
Posts: 12
I'm trying to use the sql comparison operator "like" with a named parameter, e.g.:
Code:
Query query = session.createQuery(
   "from TableModel as Table "+
   "where lower(Table.column) "+
   "like '%:someParam%'");

query.setString("someParam", someParam);

Then I get "someParam does not exist as a named parameter..." I assume I there's some way to escape this or am I using this improperly?

RMC


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 18, 2004 4:20 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Append the % to the parameter string, you can't keep it in the query like that. Also remove the ' from the query, the driver does string quoting for you.


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.