[gwt-contrib] Re: Using RequestFactory, AutoBean equality compares stableId proxyClass, which will NPE if stableId is not set.

2012-10-02 Thread Eric Friesen
Hi Thomas. Sorry for this bit of thread necromancy, but this issue is still 
a big pain for us. I think I've figured out what's going on. We currently 
use ValueProxy objects that aren't contained inside an EntityProxy. And our 
ValueProxy objects don't have an @Id annotated field. So they would have no 
stableId associated with them right? According to the RequestFactory 
documentation:

Unlike an EntityProxy, a ValueProxy is not required to expose an ID and 
version. ValueProxy is often used to represent embedded object types within 
entities

So that means ValueProxy doesn't have to have its own ID, and it is only 
usually (but not always) contained in an Entity... So sounds to me like its 
not a bug for a ValueProxy to lack a stableId, so a null check on the 
stable ID in ValueProxyCategoy doesn't seem that crazy to me. What am I 
missing? Is the documentation not correct should it say ValueProxy objects 
don't need to have their own ID, but if they don't they must be contained 
within an EntityProxy?.

It's definitely a very strange use case. This wouldn't be so hard for us 
except that we are using ValueProxy beans that are autogenerated for us, 
and it is not trivial to simply slap an @Id on one of the columns.

Thanks,

On Thursday, July 12, 2012 2:19:51 AM UTC-7, Thomas Broyer wrote:


 On Thursday, July 12, 2012 2:56:06 AM UTC+2, Eric Friesen wrote:

 This occurs in the ValueProxyCategory:


 http://code.google.com/searchframe#T04cSGC7sWI/trunk/user/src/com/google/web/bindery/requestfactory/shared/impl/ValueProxyCategory.javaq=ValueProxyCategory%20package:google-web-toolkit%5C.googlecode%5C.coml=42

 It's causing our project to not be able to compare our AutoBean objects 
 returned to us from RequestFactory requests. Would a change to check 
 whether the AutoBeans have stable ids in the first place before trying to 
 compare their proxy classes be acceptable? Or am I missing something in the 
 big picture here and it's a bad idea. As far as I can tell it's an 
 optimization to fail early without having to do a deep equals and this 
 change would be alright. If this sounds reasonable I'll put in a fix for 
 review.


 The thing is: stableId shouldn't ever be 'null', that'd be a bug.
 Maybe you create a ValueProxy AutoBean without using 
 RequestContext#create(); that's not supported, that'd be a bug in your code.


-- 
http://groups.google.com/group/Google-Web-Toolkit-Contributors

[gwt-contrib] Re: Using RequestFactory, AutoBean equality compares stableId proxyClass, which will NPE if stableId is not set.

2012-07-12 Thread Eric Friesen
Interesting. I'm using regular RequestFactory calls to the server to get 
these objects. In particular my example where this is happening is:

Call a server method to get a List of objects of type A.
Get two objects from the list (or the same object twice). and call 
a.equals(b);

So I suppose there's a way for RequestFactory to create objects without 
StableIds that I need to look into. Thanks!

-E

On Thursday, July 12, 2012 2:19:51 AM UTC-7, Thomas Broyer wrote:


 On Thursday, July 12, 2012 2:56:06 AM UTC+2, Eric Friesen wrote:

 This occurs in the ValueProxyCategory:


 http://code.google.com/searchframe#T04cSGC7sWI/trunk/user/src/com/google/web/bindery/requestfactory/shared/impl/ValueProxyCategory.javaq=ValueProxyCategory%20package:google-web-toolkit%5C.googlecode%5C.coml=42

 It's causing our project to not be able to compare our AutoBean objects 
 returned to us from RequestFactory requests. Would a change to check 
 whether the AutoBeans have stable ids in the first place before trying to 
 compare their proxy classes be acceptable? Or am I missing something in the 
 big picture here and it's a bad idea. As far as I can tell it's an 
 optimization to fail early without having to do a deep equals and this 
 change would be alright. If this sounds reasonable I'll put in a fix for 
 review.


 The thing is: stableId shouldn't ever be 'null', that'd be a bug.
 Maybe you create a ValueProxy AutoBean without using 
 RequestContext#create(); that's not supported, that'd be a bug in your code.


-- 
http://groups.google.com/group/Google-Web-Toolkit-Contributors

[gwt-contrib] Using RequestFactory, AutoBean equality compares stableId proxyClass, which will NPE if stableId is not set.

2012-07-11 Thread Eric Friesen
This occurs in the ValueProxyCategory:

http://code.google.com/searchframe#T04cSGC7sWI/trunk/user/src/com/google/web/bindery/requestfactory/shared/impl/ValueProxyCategory.javaq=ValueProxyCategory%20package:google-web-toolkit%5C.googlecode%5C.coml=42

It's causing our project to not be able to compare our AutoBean objects 
returned to us from RequestFactory requests. Would a change to check 
whether the AutoBeans have stable ids in the first place before trying to 
compare their proxy classes be acceptable? Or am I missing something in the 
big picture here and it's a bad idea. As far as I can tell it's an 
optimization to fail early without having to do a deep equals and this 
change would be alright. If this sounds reasonable I'll put in a fix for 
review.

Thanks!

-E

-- 
http://groups.google.com/group/Google-Web-Toolkit-Contributors