Using EntityProxyId in a service call

57 views
Skip to first unread message

Rob Whiteside

unread,
Jun 20, 2012, 7:20:28 PM6/20/12
to google-we...@googlegroups.com
I am using RequestFactory to fetch data from the server and have came across a situation that I can't find an answer to:

On the client I have an EntityProxyId for a proxy that I want to fetch.  Normally, I'd just do a "find" and off it goes to the server.  Then, my Locator's "find" gets called, but now this EntityProxyId is actually the ID that I can use to grab it from the database.

But, in this particular case, I'm interested in finding a particular revision of that entity.  So, I'd like to include a date or timestamp in that "find" call (at this point, i'd be able to query the db to grab the correct revision of said entity).  I can't quite figure out how to do this... Is there a way that I can create a new service call that will still do that magic translation of the EntityProxyID into the actual database Id?  That way, I can still include that extra timestamp.

Thanks!
--Rob

Thomas Broyer

unread,
Jun 21, 2012, 4:07:00 AM6/21/12
to google-we...@googlegroups.com
If you can, replace EntityProxyId with the ID of the entity (Long or String or whatever), that's the simplest and IMO cleanest way of doing what you want.

The only alternative is to help finish http://code.google.com/p/google-web-toolkit/issues/detail?id=5525 by providing a patch (looks like the only missing part is support in the GWT generator)

Rob Whiteside

unread,
Jun 25, 2012, 3:07:02 PM6/25/12
to google-we...@googlegroups.com
Just to follow up,

I more or less did what you suggested.  In my situation, I was hoping to have my UI Views be oblivious as to whether they were showing "historical" data, and needed that revision timestamp, or showing "live" data where that timestamp was not needed (and "find" could be called as normal).

I was able to abstract my service calls, and override the EntityProxyChange event.  When in "historical" mode, I can cast the EntityProxyChange to my historical version, get the ID (long in this case) and make the modified "find" call to the service.  This let me plow straight ahead, without having to change the views.

Thanks!

--Rob
Reply all
Reply to author
Forward
0 new messages