title: how to use fetch in Hibernate Query Language
body: <p>This is not a techincal problem, just a syntax correction that I am not getting.</p>
  
  <p>I have hibernate 3.6 and I have mapped my model classes in the xml files. The default type mentioned in those xml files are that these classes are to be brought as lazily. Since its hardcoded, I cannot change that behaviour.</p>
  
  <p>The model that I am trying to bring looks like this.</p>
  
  <pre><code>class A {
      private int id;
      private B b;
      private C c;
  }
  </code></pre>
  
  <p>The classes B and C needs to be loaded eagerly in my case.</p>
  
  <p>SO I wrote the query like this.</p>
  
  <pre><code>from A.class.getName() a where a.id = :id;
  </code></pre>
  
  <p>In this query, where do I put the fetch keyword.
  Below one throws errors:</p>
  
  <pre><code>from A.class.getName a fetch where a.id = :id;
  </code></pre>
  
  <p>In examples on the internet, they are doing some joins on the query and then getting some values like this:</p>
  
  <pre><code>from Cat as cat inner join fetch cat.mate left join fetch cat.kittens
  </code></pre>
  
  <p>However, in my case, all the joins are done internally in the xml files. I don't have to do joins in the query. So where do I put the "fetch" keyword to state that initiate all the linked classes (B and C) also at the same time non-lazily.</p>
  
  <p>Note:</p>
  
  <ol>
  <li>I cannot use criteria api because I don't want to add additional jars in my project.</li>
  </ol>