I personally go with Tomáš' approach as its really easy. :)
The other approach, that may or may not be 'more' correct is to make a
custom data squeezer that will transform your primary keys to objects
and vice versa for form use.

For example, I made a CayenneDataSqueezer that could take any of my
DataObjects and put them into the form with having to have the value
persistent, and I could use it where ever I wanted and not have to
worry about writing get/set methods every where.

If you want some example code let me know.

-Nick

On 9/16/05, Dan Diephouse <[EMAIL PROTECTED]> wrote:
> Thanks Patrick! Someone should put this in the FAQ :-)
> 
> - Dan
> 
> Patrick Casey wrote:
> >       Put a hidden text field at the *top* of your form so it rewinds
> > first. Put the unique ID of your persistent object there.
> >
> >       Bind that field do a property on your form.
> >
> >       In that property's setter method, load your object.
> >
> >       --- Pat
> >
> >
> >>-----Original Message-----
> >>From: news [mailto:[EMAIL PROTECTED] On Behalf Of Dan Diephouse
> >>Sent: Friday, September 16, 2005 12:00 PM
> >>To: [email protected]
> >>Subject: Database Update Cycle
> >>
> >>Howdy,
> >>I'm using T4 and a bit confused about how to create update screens. Let
> >>me explain. I have a User class which I pull from the database. I have a
> >>form which updates to properties (of many) on the User object: login and
> >>password.
> >>
> >>When I first click on "edit user" I have a edit() function which
> >>populates MyPage.user from the database.  I have a save() method which
> >>is triggered by a button on the edit form. When I click save() I want to
> >>pull the User from the DB and then have the login/password fields
> >>updated on that User object. But Tapestry always wants to create the
> >>User object itself via ognl it seems.
> >>
> >>How can I get it from the DB on the update?
> >>
> >>Thanks,
> >>
> >>- Dan
> >>
> >>
> >>---------------------------------------------------------------------
> >>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]
> 
>

Reply via email to