title: Hibernate: Sorting by a field from a linked table if foreign key is null
body: <p>Lets say I have two tables - "Cat" and "Cat owner" that are linked with many-to-one like this:</p>
  
  <pre><code>&lt;class name="com.example.Cat" table="cat"&gt;
          ... 
          &lt;many-to-one name="owner"
              class="com.example.CatOwner"
              column="owner_id" 
              not-null="false" insert="true" update="true" cascade="none" lazy="false"/&gt;
  &lt;/class&gt;
  </code></pre>
  
  <p>Now I want to get a list of all cats sorted by cat owner names, like this:</p>
  
  <pre><code>session.createQuery("from Cat cat order by cat.owner.name");
  </code></pre>
  
  <p>The problem is if a cat doesn't have an owner (owner_id=NULL), that cat won't be selected with this query. How can I make cats without owners to be present in the result?</p>
  
  <p>Thanks.</p>