title: Hibernate, getting duplicate values
body: <p>I am writing a very simple query, but I am getting duplicate values for some reason.</p>
  
  <pre><code>Criteria cr = session.createCriteria(ProcessInstance.class, "p")
          .add(Restrictions.isNull("end"));
  @Cleanup ScrollableResults sr = cr.scroll(ScrollMode.FORWARD_ONLY);
  
  while (sr.next()) {
      pi = (ProcessInstance) sr.get(0);
      String id = pi.getId(); //Getting duplicate values
  }
  </code></pre>
  
  <p>The <code>pi.getId()</code> returns duplicate values. ie: <code>*9,9,10,10,11,11 etc*</code></p>
  
  <p>However, running this query directly in mysql</p>
  
  <pre><code>SELECT * FROM JBPM_PROCESSINSTANCE J where J.END_ IS NULL
  </code></pre>
  
  <p>Does not return duplicate values.</p>
  
  <p>Can anyone spot what is wrong?</p>