for new object, stableId() not the same before/after persist

59 views
Skip to first unread message

Yan

unread,
Sep 26, 2012, 9:42:43 AM9/26/12
to google-we...@googlegroups.com
Hi there, 

I have an entity proxy object that is created on the client. After persisting into server, I would expect the returned proxy (from server) has the same stableId() (i.e., the two equals)

But this is not happening. I thought GWT documentation says the two should equal to each other. Am I missing something?  Here is the code. 

MyObjectProxy value = request.create(MyObjectProxy.class)            // value.getId() is NULL, stableId() has some value in it

request.persist(value).fire(Receiver(MyObjectProxy response) {          // response.getId() is not null,   stableId() has some value in it
     boolean isSame = response.stableId().equals(value.stableId());     // isSame return false     

Thanks,
yan

Thomas Broyer

unread,
Sep 26, 2012, 10:11:52 AM9/26/12
to google-we...@googlegroups.com
Looks very much like a bug yes. 

RickL

unread,
Sep 27, 2012, 3:20:54 PM9/27/12
to google-we...@googlegroups.com
Yan,


The important part is: "The one exception to the global scope of an EntityProxyId is the id of a newly-created EntityProxy that has not yet been persisted on the server. An "ephemeral" id is only usable with the RequestFactory from which the newly-created proxy object is derived. Once the proxy has been sent to the server and the server has provided a non-null id, the ephemeral id is upgraded to a persistent id and becomes indistinguishable from any other persistent id."

I believe that means it is working as designed. 

Rick

Thomas Broyer

unread,
Sep 27, 2012, 4:40:55 PM9/27/12
to google-we...@googlegroups.com


On Thursday, September 27, 2012 9:20:55 PM UTC+2, RickL wrote:
Yan,


The important part is: "The one exception to the global scope of an EntityProxyId is the id of a newly-created EntityProxy that has not yet been persisted on the server. An "ephemeral" id is only usable with the RequestFactory from which the newly-created proxy object is derived. Once the proxy has been sent to the server and the server has provided a non-null id, the ephemeral id is upgraded to a persistent id and becomes indistinguishable from any other persistent id."

I believe that means it is working as designed. 

Given that we're talking about BobV here (author of RequestFactory), I'd tend to agree (and knowing the internals of the EntityProxyId, I was really perplex at how to make it work as described in the Javadoc).
The Javadoc is then absolutely wrong though, as it explicitly says the contrary!
Reply all
Reply to author
Forward
0 new messages