Take the 2-minute tour ×  Hibernate retrieve returns empty list,
while populated list is expected. Involving 2 objects, mapping
done by annotations:  @Table(name = "parent") @Cache(usage =
CacheConcurrencyStrategy.READ_WRITE) class Parent {
@GeneratedValue(strategy = GenerationType.AUTO)     @Column(name
= "ID")     private long id;  @Table(name = "child")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE) class Child
{     @JoinColumn(name = "parentId")     private Parent parent;
Query performed:  String queryString = "select c from Child c
where c.parent.id = ?1"; Query q =
getEntityManager().createQuery(queryString); q.setParameter("1",
parentId); return q.getResultList();  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?  share|improve
this question add comment  3 Answers  This should fix the
problem:  q.setParameter(1, parentId);  Currently you are ca