title: Hibernate - How to Object and load foreign key objects in one SQL query?
body: <p>I would like to load my objects from database with foreign key object ( relation One-to-One )
  What I'm trying to achieve is to use my object like this.</p>
  
  <pre><code>parent.getChildrenFk().getName();
  </code></pre>
  
  <p>I know that I can do it this two ways </p>
  
  <pre><code>1. Lazy load
  
  ...
  SQLQuery sqlQuery = session.createSqlQuery("SELECT * FROM parent").addEntity(Parent.class);
  List&lt;Parent&gt; list = sqlQuery.list();
  for(Parent p : list){
  String name = p.getChildFk().getName();
  }
  return list;
  ...
  </code></pre>
  
  <p>Disadvantage of this solution is SQL query for each child ( I have more than 10000 Parent objects).</p>
  
  <pre><code>2.Second solutions is to get list of Objects[] 
  obj[0] is Parent, and obj[1] is Child
  
  SQLQuery sqlQuery = session.createSqlQuery("SELECT * FROM parent INNER JOIN child ch ON parent.child_fk = child.child_id").addEntity(Parent.class).addEntity(Child.class);
  return sqlQuery.list();
  </code></pre>
  
  <p>Disadvantage of this solution is that I can't access my Object this way <strong>parent.getChildrenFk().getName();</strong> Is there is any way to load Parent objects with Child objects in one query to have access to child obj as I wrote?</p>