Not getting value for nested proxy

22 views
Skip to first unread message

saurabh saurabh

unread,
Jun 22, 2011, 9:37:57 AM6/22/11
to Google Web Toolkit
Hi all,
again I stuck at a point in RequestFactory. I have nested
Entites like

public class Person{
private String name;
//--other properties

private Address address;

//-- getters and setters

}

****************************************

class Address{
private String city;
private String state;

//--getters and setters
}

*********************************************

@ProxyFor(value = Person.class, locator = PersonLocator.class)
public interface PersonProxy extends EntityProxy{

Long getVersion();
String getName();
String getEmail();
AddressProxy getAddress();
void setName(String name);
void setEmail(String email);
void setAddress(AddressProxy address);
EntityProxyId<PersonProxy> stableId();
}

****************************************
// other regular requestfactory things proxies, context etc

The problem is that RequestFactory is working fine its retrieving the
data from server , stuffing in PersonProxy
but not the Address property.

like

PersonProxy p[name="Saurabh", email="sau...@gmail.com", address=null]

Using debugger I noticed that from server DAO part and Locator part is
returning everything for person bean but it is resolved by "Resolver"
to domain object something like this:
p[name="Saurabh", email="sau...@gmail.com"]


Any idea whats going wrong here.

Sydney

unread,
Jun 22, 2011, 10:01:57 AM6/22/11
to google-we...@googlegroups.com
See http://code.google.com/webtoolkit/doc/latest/DevGuideRequestFactory.html 
When querying the server, RequestFactory does not automatically populate relations in the object graph. To do this, use the with() method on a request and specify the related property name as a String:

I guess you are missing the with part.

saurabh saurabh

unread,
Jun 22, 2011, 10:34:23 AM6/22/11
to Google Web Toolkit
Yes,problem resolved. you are right, the 'with()' part was missing.
Thanks a lot.
Reply all
Reply to author
Forward
0 new messages