RequestFactory: How to retrieve an EntityProxy within another EntityProxy?

18 views
Skip to first unread message

Alexander Orlov

unread,
Dec 12, 2011, 1:39:30 PM12/12/11
to google-we...@googlegroups.com
I've got sth. like:

@ProxyFor(value = Report.class, locator = CommonLocator.class)
public interface ReportProxy extends EntityProxy {
    // ...
    Integer getUserId(); // works

    void setUserId(Integer userId); 

    UserProxy getUser(); // doesn't work

    void setUser(UserProxy user); 
}

@Service(value = ReportDAOService.class, locator = DAOServiceLocator.class)
public interface ReportRequest extends RequestContext {
   // ...
    Request<List<ReportProxy>> getReports(Integer sessionId);
}


Calling getReports(sessionId) retrieves the reports where getUserId()  returns the proper userId whereby getUser() returns null. On the server side calling getUser() on result.get(0)  returns the proper entity/object value as well.

Any idea, how I can get getUser()'s UserProxy representation?

Hilco Wijbenga

unread,
Dec 12, 2011, 1:55:55 PM12/12/11
to google-we...@googlegroups.com

By default, you only get a partial proxy. See [1] and also getPaths()
of the Editor framework.

[1] http://code.google.com/webtoolkit/doc/latest/DevGuideRequestFactory.html#relationships

Alexander Orlov

unread,
Dec 13, 2011, 3:08:00 AM12/13/11
to google-we...@googlegroups.com
So you basically have to do sth. like 

final Request<List<ReportProxy>> req = ctx.getReports(sessionId).with("user"); // user is the Report entity's UserProxy representation

...which works perfectly. 
Reply all
Reply to author
Forward
0 new messages