Re: Tapestry + relationship-backed form components

From: Eric Schneider (eri..entralparksoftware.com)
Date: Tue Jul 13 2004 - 16:14:03 EDT

  • Next message: Robert Zeigler: "Re: Tapestry + relationship-backed form components"

    Robert,

    I've run into similar problems. Andrus and I talked about it, and it
    something that will probably be handled by Cayenne in future versions.
    It would be helpful in certain scenarios to set related objects (that
    are registered) on transient objects (that are not registered yet).

    Unfortunately, I don't know of an elegant elegant solution. I can
    think of a couple of approaches, but they both leave open the
    opportunity for shittiness.

    If you register the new object before you you get to form page, you can
    make every action (aside from the form's save) rollback the changes on
    the data context. This approach works, but falls short when users
    click the back button off the form page. :-\

    Another suckie option would be to break your form up into two pages.
    One to set top level properties on your object. A second to set the
    relationships once the object is registered. Again, not really ideal.

    e.

    On Jul 13, 2004, at 3:37 PM, Robert Zeigler wrote:

    > Hi,
    >
    > I keep butting my head against the "can't set XXX because A and B are
    > in a different data context" problem.
    > I'm using cayenne with tapestry.
    > I have a series of select boxes that are populated from lists obtained
    > from a globally accessible object.
    > The lists are obtained by querying for the available options using the
    > user-session-specific DataContext.
    >
    > The problem occurs when I submit the form. Because the object to which
    > the form fields are bound is not yet registered with a datacontext, an
    > exception is thrown. I don't want to register the object before form
    > submission because that tends to cause problems if the user navigates
    > to some other area of the site without submitting the form.
    >
    > I've solved this problem in some places by doing:
    >
    > register the object before the form renders the first time; override
    > validate for save for the object type to remove objects that are
    > missing necessary information that is set in the code after form
    > submission (this solves the problem of having an object in the context
    > that shouldn't be committed).
    >
    > I've also thought about creating a property in the object subclass as
    > a "temporary" holding value. However, neither of these solutions seems
    > "right". What am I missing in cayenne to do this correctly?
    >
    > Thanks,
    >
    > Robert
    >



    This archive was generated by hypermail 2.0.0 : Tue Jul 13 2004 - 16:15:17 EDT