Tuesday, February 19, 2013

Re: ValueProxy inheritance trouble, always load properties

No, it's due to RF support for polymorphism of proxies. Simply break the inheritance relationship between Data and DataDetail and it'll all work as you expect. If you want to share properties between them then define an intermediate interface that does NOT extend ValueProxy:

interface DataProperties { … }
@ProxyFor(DataEntity.class) interface Data extends DataProperties, ValueProxy { }
@ProxyFor(DataEntity.class) interface DataDetail extends DataProperties, ValueProxy { … }

On Monday, February 18, 2013 9:20:11 PM UTC+1, Yan wrote:
Hi there, 

This seems to be a GWT 2.5 issue. 

I have two ValueProxy: Data and DataDetail, DataDetail extends Data, both are proxy for backend entity DataEntity.  DataDetail has more properties than Data does. The reason I have two proxy for one single entity is because I want to load a list of Data objects first and then for a given Data object, load all its details as DataDetail.   This is how I implement loading-details-on-demand so that I do not load too much data in the beginning. 

List<Data>  getAllObjects();                 <=== load only minimum set of data for all objects
DataDetail   getObjectDetail(id);            <=== load as much as I can for one object

If I have DataDetail extending Data, then GWT is always loading all properties in DataDetail (even for getAllObjects() call), because ProxyAutoBean is loading properties defined in DataDetail, even though the interface is only using Data value proxy. 

But if I have DataDetail duplicate properties in Data (thus I do not need DataDetail extends Data), then everything works as expected. 

Is this a GWT bug?

Thanks,
yan

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments:

Post a Comment