title: HQL one to many select single object in single query
body: <p>I want to retrieve such object of class A that has "inside" object C.</p>
  
  <p>I have a class A:</p>
  
  <pre><code>public class A {
  ...
  @OneToMany(mappedBy = "classA")
  private List&lt;B&gt; listOfB;
  
  }
  </code></pre>
  
  <p>class B:</p>
  
  <pre><code>public class B {
  
  ...
  @ManyToOne
  @JoinColumn(name = "A_FK")
  private A AObject;
  
  @OneToMany(mappedBy = "classB")
  private List&lt;C&gt; ListOfC;
  
  }
  </code></pre>
  
  <p>and class C:</p>
  
  <pre><code>public class C {
  ...
  
  private String CId;
  
  @ManyToOne
  @JoinColumn(name = "B_FK")
  private B BObject;
  
  
  }
  </code></pre>
  
  <p>Explanation: I have objects A which have list of objects B (one B object can be in only one object A), every object B has inside few objects C (object C can be in only one B). </p>
  
  <p>How can I retrieve object A using single HQL query, knowing Id of object C?</p>