-->
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: Parametric like query
PostPosted: Tue Mar 15, 2005 5:51 am 
Newbie

Joined: Mon Feb 14, 2005 10:11 am
Posts: 10
Location: Italy
Hi, I'm a new user of hibernate and I have to make a simple query but I encounter a problem.

I want to find documents with title that contains a string passed as a parameter.

This is my query....

s.createQuery("from Document d where d.title like %:searchInTitle%")
.setString("searchTitle",title)
.list();

Hibernate return me this error:
Parameter title does not exist as a named parameter in [from Document d where d.title like %:searchInTitle%]


Help me... thanks

_________________
Ing. Marco Rinaldi - Italy


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 15, 2005 6:58 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
use

s.createQuery("from Document d where d.title like :searchInTitle")
.setString("%searchTitle%",title)
.list();


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.