title: Hibernate Criteria Join with 3 Tables
body: <p>I am looking for a hibernate criteria to get following:</p>
  
  <p>Dokument.class
  is mapped to Role
  roleId</p>
  
  <p>Role.class
  has a ContactPerson
  contactId</p>
  
  <p>Contact.class
  FirstName
  LastName</p>
  
  <p>I want to search for First or LastName on the Contact class and retrieve a list of Dokuments connected.</p>
  
  <p>I have tried something like this:</p>
  
  <pre><code>session.createCriteria(Dokument.class)
  .setFetchMode("role",FetchMode.JOIN)
  .setFetchMode("contact",FetchMode.JOIN)
  .add(Restrictions.eq("LastName","Test")).list();
  </code></pre>
  
  <p>I get an error could not resolve property "LastName" for class "Dokument"</p>
  
  <p>Can someone explain why the join searches on Dokument and not on all joined tables? Thanks in advance for all the help!</p>