-->
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: HQL - Conditions on collections
PostPosted: Tue Apr 27, 2010 7:05 pm 
Newbie

Joined: Tue Apr 27, 2010 5:35 pm
Posts: 1
I'm noticing some weird behaviour with HQL when I use implicit joins while referencing a collection. Take the following example query:

Code:
from Sample sample
where sample.shipment.sampleCollection.size =
(select count(*) from sample.shipment.sampleCollection samples where samples.name='Blood')


in english: "give me all samples where the whole shipment contained only blood". For reasons i wont go into, the all keyword cannot be used.

The strange part is that I get an error stating that "name" is not a property of "Shipment". However, if "from sample.shipment.sampleCollection" was instead, for example, "from sample.sampleCollection" the error goes away. What this leads me to believe is that when performing a "from" on a collection, only one dot-notation implicit join is allowed prior to the name of the collection. This is strange, considering that the rest of the time i can throw around implicit joins just as if I were manipulating objects.

Can someone help me rephrase this query, or tell me what I'm doing wrong?


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.