I meant that if the version has changed, of course. -----Original Message----- From: James Carman [mailto:[EMAIL PROTECTED] Sent: Thursday, March 30, 2006 4:52 PM To: 'Tapestry users'; [EMAIL PROTECTED] Subject: RE: Keeping an object intact and only applying changed values
I just keep the object in the http session and then reattach it to the hibernate session. Then, I can update only the properties that I want. If the version hasn't changed, it'll throw an exception when I reattach it. -----Original Message----- From: Matt Raible [mailto:[EMAIL PROTECTED] Sent: Thursday, March 30, 2006 4:49 PM To: Jesse Kuhnert Cc: Tapestry users Subject: Re: Keeping an object intact and only applying changed values 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 --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
