title: How to implicitly join across collections in Hibernate?
body: <p>The object structure is like below-</p>
  
  <pre><code>Entity A
    - Collection &lt;B&gt;
  
  Entity B
    - Collection &lt;C&gt;
  
  Entity C
    -Collection &lt;D&gt;
  
  Entity D
    CompositePrimaryKey
  
  Class CompositePrimaryKey
    String id;
  </code></pre>
  
  <p>In the HQL, the query is like <strong>from A a where a.B.C.D.CompositePrimaryKey.id = 'input';</strong></p>
  
  <p>I am getting the below exception-</p>
  
  <p>org.hibernate.QueryException: illegal attempt to dereference collection</p>
  
  <p>Basically this is implicit join across the collections.
  What is the right approach to do this?</p>
  
  <p>I want to fetch all data through the collections - based on the id value</p>
  
  <p>Thank you.</p>