Wednesday, January 30, 2013

Re: RequestFactory and outdated client data

This is one reason RF only sends diff of changes (for EntytProxy-s): you changed property 'name' to "Foo", but property 'city' is unchanged (on the client-side), the same changes should be applied on the server-side: set name to "Foo", don't touch 'city' (so it can have been modified by another user/process).
As with any client-server app, your client should "refresh" its data regularly to try to keep it uptodate, but that's independent from RequestFactory.

On Tuesday, January 29, 2013 12:27:03 PM UTC+1, Manuel Malhado wrote:

I am currently working on a project that uses GWT 2.4 on the client side, RequestFactory as the transport layer, and Apache Tomcat and Hibernate on the server side.

The trouble I'm having involves a service call that results in changes in a database Entity which as it happens is not the object that is returned by the same service. Since this same entity has already been obtained by the client in a previous request, the client version of it becomes outdated.

This actually shouldn't be a problem since the entity field that has been changed is no longer required by the client.

The problem is that when the client references this same entity as an argument of a following service call, without any client side explicit changes being performed to it, requestfactory internal decorator procedures responsible for rebuilding the entity on the server side seem to be persisting the outdated data (by performing calls to the entity's Set methods, which are detected by the hibernate session and scheduled for update when the transaction is committed).

Is this issue simply a design flaw, and any changes to entities (still being used by the client) that result from a service call should be somehow explicitly refreshed? I don't think this would work in all situations since the same entity might still become outdated by changes performed by server site automatic procedures or even another client call.

It seems to me that requestfactory should be able to detect when an entity passed in a service argument is outdated (by comparing the client version of it with the one returned by the entity's getVersion() method), and throw a warning in the form of an exception or something, or at least ignore the outdated data (which would be more than enough in my situation).

--
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