I have a entity proxy A that contains a collection of relations (List<B>),
which corresponds to a standard @OneToMany association in JPA. My edit view
of proxy A contains a HasDataEditor<B> implementation managing the list of
associations. The form also allows an arbitrary number of new B proxies to
be added as relations. When adding a new B, I have a popup form that
implements Editor<B>, which I use to edit the properties of the new
instance. When that form is confirmed, I flush its editor driver, and add
the proxy instance to the HasDataEditor<B> list in the main form. In this
way, new B instances are only created on the server when A is persisted and
the object graph is sent along with the request. In order for this to work,
I have to use the RequestContext that is managing edits of A when I create
new B proxy instances. And it works great if the B instances I instantiate
can always be submitted in a valid state.

The problem I'm having is that once I create a new proxy B in the
RequestContext managing A, I can't seem to remove it. For example, if I
click the "Create new B" button and then close the popup form immediately,
the new proxy created for adding the aborted B is stuck in the
RequestContext. Even though B is never added to the HasDataEditor<B> element
in the form for A, it will be submitted as part of the set of objects being
edited by the RequestContext. This can lead to a state where the form for A
cannot be submitted due to validation errors from lingering (ostensibly
discarded) B instances.

What would work for me is a way to remove proxies from a RequestContext's
map of editedProxies. I was also thinking that using RequestContext
appending instead of editing everything in the same context might be a work
around... Does anyone know of another way to work around this issue?

Jesse

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to