You should queue the method invocation once only, at the time you receive the proxy to edit it, not at the time you want to fire() the prepared bacth-request.
On Monday, January 20, 2014 9:32:02 AM UTC+1, Florian Felberbauer wrote:
-- On Monday, January 20, 2014 9:32:02 AM UTC+1, Florian Felberbauer wrote:
Hello Alex,it's been a while since you posted your problem but as I have the same problem now, I wanted to ask if you were able to fix it in the meantime.As you said, the problem is that both onConstraintViolation(...) and - after fixing the wrong data - even onSuccess(...) is fired multiple times because the request needs to stay the same (otherwise I get an error when trying to edit a proxy which has been edited by another request context).Thank you in advance!best regards,Flo
Am Freitag, 27. April 2012 11:59:28 UTC+2 schrieb Alex Vakaloudis:To perform a save in a view I am using the RequestFactoryEditorDriver to flush any changes to a RequestContext and then I call save(the edited proxy).to(MyReceiver<Void>).fire(); MemberRequest s = (MemberRequest)editorDriver.flush(); MemberProxy sectorProxy = (MemberProxy)getProxy();s.saveMember(sectorProxy).to(new MyReceiver<Void>()).fire(); MyReceiver has a onConstraintViolation method which displays violations generated in the server. I am using my own ServiceLayerDecorator.validate() to check for any business-related constraints. To this point it works fine. However when after more than one attempts the user finally "fixes" all violations and the entity reaches the service layer, the save method is invoked multiple times (as many attempts it took to pass validation). I understand that this is because the request context is queuing all method invocations and by calling onConstraintViolation. this queue is not cleared. As a result, when it passes validation there is a number of onvocations for saving which all then succeed in inserting to the database.My question is how/where to clear the request context of any method invocations that have lead to the call of onConstraintViolation so the save to the service layer is called once only.thanks in AdvanceAlex
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.
For more options, visit https://groups.google.com/groups/opt_out.
No comments:
Post a Comment