title: Hibernate lazy fetch empty after one result was empty
body: <p>Well hello,</p>
  
  <p>I am writing a console application that is connected to a postgres database and i've come across the following problem: </p>
  
  <pre><code>public List&lt;String&gt; getCommonInterestsOfMyFriends(long personId) {
  
       Person personOfIntrest = session.get(Person.class, personId);
       //fetch friends from db via get Call
       int size = personOfIntrest.getFriends().size();
       int size2 = personOfIntrest.getFriendsWith().size();
       int size3 = personOfIntrest.getIntrests().size();
  
      Set&lt;Tag&gt; interests = personOfIntrest.getIntrests();
  
      Set&lt;Person&gt; allFriends = personOfIntrest.getFriendships().keySet();
  
      for (Person p : allFriends) {
  
           Set&lt;Tag&gt; friendsInterests = p.getIntrests();
           friendsInterests.retainAll(interests);
      } 
   }
  </code></pre>
  
  <p>A person can have interests modeled by a ManyToMany relationship with a join table. 
  I call the code above several times and it works totally fine until i come across a Person that has no interests. 
  After that, for every Person the "interests" Set is empty, even though the set was successfully loaded before. </p>
  
  <p>To intialize the lazy association i call the getters, i also tried fetch joins  </p>
  
  <pre><code>// fetch associated data via fetch join
      Query q = session.createQuery("SELECT p FROM Person p " 
                                  + "LEFT JOIN FETCH p.friends "
                                  + "LEFT JOIN FETCH p.friendsWith " 
                                  + "LEFT JOIN FETCH p.intrests " 
                                  + "WHERE p.id = :id");
      q.setParameter("id", personId);
      Person personOfIntrest = (Person) q.getSingleResult();
  </code></pre>
  
  <p>Still the same Problem.
  The set of interests is successfully loaded as long as i did not query for a person that has no interests, after that the set is empty for any Person.
  This is all in the same Session. </p>
  
  <p>Thanks for the Help,
  kind regards</p>