is this the pattern, re-retrieve server side object after persisting?

26 views
Skip to first unread message

Yan

unread,
Sep 26, 2012, 10:30:20 AM9/26/12
to google-we...@googlegroups.com
Hi there, 

One question about GWT request factory is that both RequestContext and Proxy objects are one-off kind. In other words, a requestContext is fired once and discarded. Because of that, client proxy is not supposed to be kept around, either. 

In addition, the persist().fire(Receiver<Proxy response>  pattern returns a copy of server side object, but has no children in it (only attributes). That creates a problem for me. 

Say, I have an object tree, Parent has a list of children, which in turn a list of grand-children, etc. 

With GWT 2.4, I set an ParentEntityProxy to edittable, make changes, fire the request. The returned server side proxy (Response) only has parent attributes (i.e., the children attribute is NULL), even though my JPA backend returns the entire object tree.

This means after I fire the persist request, when it returns successful, I have to immediately fire another request to fetch the entire object tree again (otherwise I do not get any children objects).  

That is the only way to only use any RequestContext and ClientProxy only once.  Is this a correct pattern?

Thanks,
Yan

Thomas Broyer

unread,
Sep 26, 2012, 10:37:59 AM9/26/12
to google-we...@googlegroups.com


On Wednesday, September 26, 2012 4:30:20 PM UTC+2, Yan wrote:
Hi there, 

One question about GWT request factory is that both RequestContext and Proxy objects are one-off kind. In other words, a requestContext is fired once and discarded. Because of that, client proxy is not supposed to be kept around, either. 

In addition, the persist().fire(Receiver<Proxy response>  pattern returns a copy of server side object, but has no children in it (only attributes). That creates a problem for me. 

Say, I have an object tree, Parent has a list of children, which in turn a list of grand-children, etc. 

With GWT 2.4, I set an ParentEntityProxy to edittable, make changes, fire the request. The returned server side proxy (Response) only has parent attributes (i.e., the children attribute is NULL), even though my JPA backend returns the entire object tree.

This means after I fire the persist request, when it returns successful, I have to immediately fire another request to fetch the entire object tree again (otherwise I do not get any children objects).  

persist().with("children.grandchildren").fire(…) ?

Reply all
Reply to author
Forward
0 new messages