title: Hibernate JPA empty result with correct query
body: <p>Hibernate retrieve returns empty list, while populated list is expected.
  Involving 2 objects, mapping done by annotations:</p>
  
  <pre><code>@Entity
  @Table(name = "parent")
  @Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
  class Parent {
      @Id
      @GeneratedValue(strategy = GenerationType.AUTO)
      @Column(name = "ID")
      private long id;
  }
  
  @Entity
  @Table(name = "child")
  @Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
  class Child {
      @ManyToOne
      @JoinColumn(name = "parentId")
      @OrderBy(value="id")
      private Parent parent;
  }
  </code></pre>
  
  <p>Query performed:</p>
  
  <pre><code>String queryString = "select c from Child c where c.parent.id = ?1";
  Query q = getEntityManager().createQuery(queryString);
  q.setParameter("1", parentId);
  return q.getResultList();
  </code></pre>
  
  <p>When hibernate executes that set of code it returns a list with size = 0. Turning SQL logging on and performing the query provided in the logs in MAMP returns the expected result, any one any ideas?</p>