I use a custom persistence strategy to reattach the entity. That seems to work just fine.
-----Original Message----- From: Jesse Kuhnert [mailto:[EMAIL PROTECTED] Sent: Thursday, March 30, 2006 5:14 PM To: [EMAIL PROTECTED] Cc: Tapestry users Subject: Re: Keeping an object intact and only applying changed values Busted? I think not! Hehehe...I was taking a shower. If I were doing it(and I am), I would re-attach the object to the sesssion ~before~ the form sets the new values. Ie using a listener method. I would double check your BS meter though, as I haven't played with hibernate in a couple weeks, but I think what I'm saying is true. On 3/30/06, Matt Raible <[EMAIL PROTECTED]> wrote: > > So how do you apply all the values from the form to the object you > fetched from the database? > > On 3/30/06, Jesse Kuhnert <[EMAIL PROTECTED]> wrote: > > If it's any consolation I do it this way and it works fine. I usually > store > > the object key as a session persisted value that I use to re-init with > > hibernate on pageBeginRender . (Unless it's a new entity ) > > > > > > On 3/30/06, Matt Raible <[EMAIL PROTECTED]> wrote: > > > I'll try to get back to you with a more concrete example in the next > > > few hours. For all I know, it's already working as desired in > > > Tapestry. I'll prove it doesn't before posting a reply. > > > > > > Matt > > > > > > On 3/30/06, Jesse Kuhnert < [EMAIL PROTECTED]> wrote: > > > > I'm confused...If I had a User object with 5 out of 10 members that > I > > wanted > > > > to edit then I'd have these sorts of ognl: bindings to the field > values: > > > > > > > > <input type="@TextField" value="ognl:user.firstName " /> > > > > > > > > Then my POJO would only have the 5 of 10 values I'm mucking with > > updated. Am > > > > I being retarded or did this answer your question? > > > > > > > > > > > > On 3/30/06, Matt Raible <[EMAIL PROTECTED]> wrote: > > > > > > > > > Spring MVC and WebWork have some pretty easy ways to re-fetch an > > > > object from the database before applying request parameters on a > post. > > > > This provides a way to have your POJOs live in request scope and > not > > > > put them in the session during an edit/save cycle. Furthermore, you > > > > don't have to put *all* the properties of a POJO in hidden fields. > > > > For those fields that aren't passed in, the properties are not > > > > overwritten. > > > > > > > > Does Tapestry have a similar mechanism? > > > > > > > > I want to edit, display 5 out of 10 fields, and when I save - only > > > > have those 5 fields change instead of nullifying the fields I didn't > > > > pass in. > > > > > > > > My guess is this is built-in, and I'm doing something to > short-circuit > > > > the behavior. Here's what I have on one of my pages: > > > > > > > > public void pageBeginRender(PageEvent event) { > > > > if (getUser() == null && > > > > !event.getRequestCycle().isRewinding()) { > > > > setUser(new User()); > > > > } else if ( event.getRequestCycle().isRewinding()) { > > > > setUser(new User()); > > > > } > > > > } > > > > > > > > I tried removing the 2nd one to get the desired behavior - is this > the > > > > best way to do that? > > > > > > > > Thanks, > > > > > > > > Matt > > > > > > > > > > --------------------------------------------------------------------- > > > > To unsubscribe, e-mail: > > > > [EMAIL PROTECTED] > > > > For additional commands, e-mail: > > > > [EMAIL PROTECTED] > > > > > > > > > > > > > > > > > > > > -- > > > > Jesse Kuhnert > > > > Tacos/Tapestry, team member/developer > > > > > > > > Open source based consulting work centered around > > > > dojo/tapestry/tacos/hivemind. http://opennotion.com > > > > > > > > > > > -- > > > > Jesse Kuhnert > > Tacos/Tapestry, team member/developer > > > > Open source based consulting work centered around > > dojo/tapestry/tacos/hivemind. http://opennotion.com > -- Jesse Kuhnert Tacos/Tapestry, team member/developer Open source based consulting work centered around dojo/tapestry/tacos/hivemind. http://opennotion.com --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
