RequestFactory and @OneToMany association

46 views
Skip to first unread message

Daniel Mauricio Patino León

unread,
Apr 16, 2012, 3:21:41 PM4/16/12
to google-we...@googlegroups.com
Iam stuck here! any help would be appreciated. (sorry for duplicate the post : http://stackoverflow.com/questions/10180282/requestfactory-and-onetomany-association )

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.

Aidan O'Kelly

unread,
Apr 16, 2012, 4:27:02 PM4/16/12
to google-we...@googlegroups.com
You'll probably need: 
with("parents", "parents.childs") 

getChilds() is not a method on your Callback object.. 

2012/4/16 Daniel Mauricio Patino León <ceo.li...@gmail.com>

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/0J0QrK3tolYJ.
To post to this group, send email to google-we...@googlegroups.com.
To unsubscribe from this group, send email to google-web-tool...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

Daniel Mauricio Patino León

unread,
Apr 17, 2012, 8:50:54 PM4/17/12
to google-we...@googlegroups.com
Yes was the issue. Thank you.  Aidan  
--
ISC. Daniel Mauricio Patiño León.
Director ejecutivo
Liondev S.A. de C.V.



Reply all
Reply to author
Forward
0 new messages