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?