-->
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.  [ 3 posts ] 
Author Message
 Post subject: trouble using the setParameterList in HQL
PostPosted: Sun Jan 08, 2006 11:58 pm 
Newbie

Joined: Mon Dec 20, 2004 9:08 pm
Posts: 9
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:
2.1.7

Mapping documents:

Code between sessionFactory.openSession() and session.close():

net.sf.hibernate.Query hQuery = session.createQuery("FROM obsRequest in class test.app.persistencebeans.ObservationRequest WHERE obsRequest.person in elements(:personList) and obsRequest.storageStatus = :storageStatus");
hQuery.setString("storageStatus", "O");
hQuery.setParameterList("personList", personnel);
query = new HibernateQuery(hQuery);

//where personnel is a list of Person Objects

Full stack trace of any exception that occurs:

test.app.persistence.PersistenceException: net.sf.hibernate.QueryException: Named parameter does not appear in Query: personList0_ [FROM obsRequest in class test.app.persistencebeans.ObservationRequest WHERE obsRequest.person in elements(:personList0_) and obsRequest.storageStatus = :storageStatus]
at test.app.persistence.hibernate.HibernatePersister.fetch(HibernatePersister.java:219)



Name and version of the database you are using:

The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 09, 2006 12:54 am 
Expert
Expert

Joined: Thu May 26, 2005 9:19 am
Posts: 262
Location: Oak Creek, WI
Hi,

elements is not required in the query if i am right.

for eg.,
Query q = sess.createQuery("from DomesticCat cat where cat.name in (:namesList)");
q.setParameterList("namesList", names);
List cats = q.list();


Also do Look into this,
http://forum.hibernate.org/viewtopic.ph ... 86f3a48abc

_________________
RamnathN
Senior Software Engineer
http://www.linkedin.com/in/ramnathn
Don't forget to rate.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 09, 2006 4:09 pm 
Newbie

Joined: Mon Dec 20, 2004 9:08 pm
Posts: 9
Thanks. removing the 'elements' keyword worked!


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