-->
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.  [ 1 post ] 
Author Message
 Post subject: named parameter binding for list indices?
PostPosted: Tue Mar 07, 2006 6:14 am 
Newbie

Joined: Tue Mar 07, 2006 5:41 am
Posts: 1
I have a question concerning the upgrade from hibernate 2.1.8 to 3.1.2 with respect to the binding of named parameters.

I have a query of the following form in my java code:

Query q =
session.createQuery(
"select cat from foo.Cat cat, foo.CatList catList" +
"where catList.id=:listId and catList.cats[:listPosition] = cat"
}
q.setInteger("listPosition", position);
q.setLong("listId", id.longValue());
return (Cat) q.uniqueResult()

There is a many-to-many relationship between CatList and Cat (CatList is a list of Cat objects)

This code used to work in v2.1.8 but fails with 3.1.2.

I have turned on show_sql in my hibernate.cfg.xml file and have verified the sql generated is correct. I then replaced the named parameters with the actual values and the code worked perfectly. It appears that the problem is related to the binding of named parameters.

I tried binding named parameters in simple situations e.g. catList.id=:id, which works fine. Perhaps there is a bug in the binding of named parameters when it comes to list indices?

Thank you in advance.

Yuan Chang


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

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.