title: Incorrect size of entity collection from relation
body: <p>I encountered strange problem while writting my application. I have two entities connected with bi-directional relation.</p>
  
  <pre><code>@Entity
  @NamedQueries( value = {
      @NamedQuery( name = "Employee.findAll", query = "SELECT e FROM Employee e")
  })
  public class Employee extends AbstractModel&lt;Long, Employee&gt;{
      @ManyToMany(fetch = FetchType.EAGER)
      @JoinTable( name = "EMP_TASK", joinColumns = {@JoinColumn( name = "EMP_ID", referencedColumnName = "ID")},
              inverseJoinColumns = {@JoinColumn( name = "TASK_ID", referencedColumnName = "ID")})
      private Set&lt;Task&gt; tasks = new HashSet&lt;&gt;();
  }
  
  @Entity
  public class Task extends AbstractModel&lt;Long, Task&gt;{
      @ManyToMany( mappedBy = "tasks", fetch = FetchType.EAGER)
      private Set&lt;Employee&gt; employees = new HashSet&lt;&gt;();
  }
  </code></pre>
  
  <p>I'm querying for list of employees using NamedQuery <code>Employee.findAll</code> and sending it to jsp</p>
  
  <pre><code>@Override
  protected void processDefaultAction() throws ServletException, IOException {
      List&lt;Employee&gt; employees = employeeService.findAll();
      request.setAttribute("employees", employees);
      forward("employees");
  }
  </code></pre>
  
  <p>The problem  occurs when I'm trying to display Employee information  in  jsp with additional column Number of tasks which contains <code>${fn:length(emp.tasks)}</code>.</p>
  
  <p>For some of the entities, the value displayed is lower than it should e.q. 2 instead  of 3 ( in database 3 relations exists for given employee ). However when I change servlet code to:</p>
  
  <pre><code>@Override
  protected void processDefaultAction() throws ServletException, IOException {
      List&lt;Employee&gt; employees = new LinkedList&lt;&gt;();
      for(Employee emp : employeeService.findAll())
          employees.add(employeeService.find(emp.getId()));
      request.setAttribute("employees", employees);
      forward("employees");
  }
  </code></pre>
  
  <p>everything is displayed properly. 
  It looks like fetching all employees at once with their relations wasn't working properly. Any idea what can  be the reason of such behaviour?</p>