title: Query builder join on one to many relationship
body: <p>I have a LastTrait object that has a many to one relationship with my user object: one user can have many different lastTrait:</p>
  
  <pre><code>YOP\YourOwnPoetBundle\Entity\LastTrait:
    type: entity
    table: null
    fields:
  id:
    type: integer
    id: true
    generator:
      strategy: AUTO
  traitCategoryID:
    type: integer
  verseID:
    type: integer
    manyToOne:
  user:
    targetEntity: User
    inversedBy: lastTrait
    joinColumn:
        name: user_id
        referencedColumnName: id
  </code></pre>
  
  <p>I need to retrieve the verseID knowing the userID and traitCategoryID. So I created a Repository for my LastTrait object:</p>
  
  <pre><code>&lt;?php
  
  namespace YOP\YourOwnPoetBundle\Repository;
  
  use Doctrine\ORM\EntityRepository;
  
  class LastTraitRepository extends EntityRepository {
  
  public function findOneByTraitCategoryID($userID, $traitCategoryID)
  {
      return $this-&gt;getEntityManager()
      -&gt;createQuery('SELECT l
          FROM YOPYourOwnPoetBundle:LastTrait l
          JOIN l.user u
          WHERE l.traitCategoryID = :categoryID AND u.id = :userID')
      -&gt;setParameters(array(
          'categoryID' =&gt; $traitCategoryID,
          'userID' =&gt; $userID,
      ))
      -&gt;getResult();
  }
  }
  
  ?&gt;
  </code></pre>
  
  <p>However, when I call :</p>
  
  <pre><code>$lastTrait = $this-&gt;getDoctrine()
          -&gt;getRepository('YOPYourOwnPoetBundle:LastTrait')
          -&gt;findOneByTraitCategoryID($user-&gt;getID(), $collector-&gt;getTraitCategory()-&gt;getID());
  </code></pre>
  
  <p>I always get NULL, even though I should get a LastTrait object back!</p>
  
  <p>What am I doing wrong here?</p>