title: How to construct a hibernate query that uses a single element of all elements in a collection?
body: <p>Here's the situation:</p>
  
  <p>I have a datatype C that has a one-to-many reference to Datatype P.
  Datatype P has an optional R reference (one to one).</p>
  
  <p>My attempted query was as follows (it was a count, but it will also be used to pull data)</p>
  
  <pre><code>FROM C WHERE ... AND P.R.rProperty LIKE 'BLAH%';
  </code></pre>
  
  <p>I get a </p>
  
  <pre><code>org.hibernate.QueryException: illegal attempt to dereference collection 
  [C.C_SEQUENCE_NUMBER.P] with element property reference [R] [select count(*) FROM C a WHERE a.DATE_FIELD &gt;= ? AND a.DATE_FIELD &lt;= ? AND a.P.R.rProperty LIKE ?]
  </code></pre>
  
  <p>Any hints/suggestions?</p>