[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[eclipselink-users] Problem with loading of data with a OneToMany relationship
|
Hi,
I've got a problem with my OneToMany relationship. The depending data won't be loaded. Here a shorted listing of my coding:
================= SNIP =================
public class Group {
private String name;
@OneToMany(mappedBy = "group", fetch = FetchType.EAGER)
private List<Entry> entries = new ArrayList<Entry>();
// ... getter/setter
}
public class Entry {
@ManyToOne
@JoinColumn(name = "FK_GROUP_ID")
private Group group;
// ... getter/setter
}
================= SNAP =================
I try to fetch the data using the JpaEntityManager (the jpaEm var) and ExpressionBuilder (the builder var):
================= SNIP =================
Query qry = jpaEm.createQuery(builder.get("name").equal(builder.getParameter("searchName")), Group.class);
qry.setParameter("searchName", name);
Object result = qry.getSingleResult();
================= SNAP =================
So the "result" is a valid instance of Group but the list of entries are empty, although there are 3 entries with the correct group-id in the database. There is no other errors by eclipselink or anything else.
Hope someone can help me and I'm very glad about some suggestions. Thanks in advance.
Regards
Christian