RequestFactory complexity (Frozen Beans et. all)

116 views
Skip to first unread message

dparish

unread,
Feb 6, 2012, 1:36:46 PM2/6/12
to Google Web Toolkit
I really want to like RequestFactory, really I do, but I'm astounded
by the complexity. I finally got my head around the Locator, the
proxies, etc and now I'm getting Frozen beans and "edited by another
RequestContext" errors.

I took a look at: http://fascynacja.wordpress.com/tag/autobean-has-been-frozen/
and this helped alot, but I'm astounded that my code has to trap for
all this stuff.

1. Does anyone know if the GWT is going to change so that this state
doesn't have to be managed?
2. Anyone have any helper classes that can trap for this stuff?
3. Any best practices?

All I want to do is:
1. Edit a previously loaded entity
2. Create a new entity and save it

I must be making this harder than it actually is or else very few
folks use this successfully.

Thomas Broyer

unread,
Feb 6, 2012, 4:42:55 PM2/6/12
to google-we...@googlegroups.com
> I took a look at: http://fascynacja.wordpress.com/tag/autobean-has-been-frozen/and this helped alot, but I'm astounded that my code has to trap for all this stuff.

This is a great post!

You don't have many things to do if you just follow the "flow" of operations.

> 1. Does anyone know if the GWT is going to change so that this state doesn't have to be managed?

Not going to change, no, that's by design, with pretty good reasons backing those choices (and they quickly become obvious if you think more about it)

> 2. Anyone have any helper classes that can trap for this stuff?

No need for anything actually.

> 3. Any best practices?

Never pass a proxy as argument to a service method if its Id is enough.
Use relationships between proxies sparingly.

> All I want to do is: 1. Edit a previously loaded entity 2. Create a new entity and save it
>
> I must be making this harder than it actually is or else very few folks use this successfully.

You must be complicating things, as even with rather complex workflows, we're been successful with RF (though we had to fix a bunch of bugs; have a look at the ReviewPending issues in the tracker)

Joshb

unread,
Feb 10, 2012, 10:50:02 AM2/10/12
to google-we...@googlegroups.com
dparish,

I feel your pain.  I have tried to get an answer for this for a long time.  Thomas has been very helpful, but I still don't have an answer, and am a little baffled that there does not appear to be a straight-forward solution for what looks to be a pretty common use case.  Your post (and the referenced blog post) inspired me to write a little about our experience with request factory here: http://www.joshisonit.com/2012/02/our-experience-with-gwts-requestfactory/.  For such a mature and well used library, GWT really does have a dearth of strong documentation/tutorials, especially when it comes to some of the newer functionality like RequestFactory.

Brandon Donnelson

unread,
Feb 19, 2012, 11:43:56 PM2/19/12
to google-we...@googlegroups.com
Here is an example of using Activities & Places, RequestFactory and Editors. 
http://c.gwt-examples.com/home/ui/places

I find RequestFactory is quite simple once you master the 3 classes you need to get stuff done. It's by far superior to RPC. 
Reply all
Reply to author
Forward
0 new messages