I have a Parent class with a one-to-many relationship with Child. The member variable in Parent looks like:
Code:
@OneToMany
@JoinColumn(name="parent_id")
private List<Child> child;
The HQL looks like:
Code:
from Parent p join fetch p.child c
Say I have two parent records, the first with three children and the second with two. I expect the above HQL to return a List of Parent with size = 2. Instead it returns a List of Parent with size = 5, as the first Parent object is repeated three times (I guess once for each child) and the second Parent object is repeated twice.
Is this the result I should expect? I want a list with just one entry each for each Parent object.