My case is that i have a @OneToMany association on my module.
class Parent{
@OneToMany(
mappedBy="parent"
)
return List<Child> getChilds();
}
class Child{
@ManyToOne
return Parent getParent();
}
The in the client side i want get get the whole object map.
i do this (AsyncDataProvider with a DataGrid as display):
requestContext.getParents().with("childs").fire(new Receiver<CallbackProxy>() {
@Override
public void onSuccess(CallbackProxy response) {
display.setRowData(range.getStart(),response.getParents());
updateRowCount(response.getCount().intValue(), true);
}
});
My DAO its just querying the whole map.
Criteria criteria = session.createCriteria(Parent.class);
criteria.setFetchMode("childs", FetchMode.JOIN);
criteria.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY);
/* we got all the map here on the server side */
Callback callback = new Callback();
callback.setCount(count);
callback.setParents(criteria.list());
return callback;
But i cant get the childs. The list of them are null. Please note iam using with("childs")
Thank you.