On 1/18/07, Mitesh Meswani <[EMAIL PROTECTED]> wrote:
I think it is not a  good idea to mutate Primary Key (ID) field of any pojo.

I agree.

Many persistence providers might choke if a pk field is mutated.
Pardon my ignorance on Struts - How are these forms used at runtime? Do
they correspond to any screen in UI?

Yes, here's how it works:

When a HTTP POST comes in to update a FooData object, Struts hands us
a FooForm object containing the data from the posted web form.

We use FooForm.id to load the corresponding FooData object from the
database, use FooForm.copyTo() to copy all updated properties to the
FooData object and then we call FooManager.saveFoo() to persist those
chances.

Technically, the call to saveFoo() isn't necessary with Hibernate or
JPA because FooData is a persistent/managed object, but perhaps other
persistence frameworks (iBatis?) might beed that final call to
FooManager.saveFoo().

- Dave

Reply via email to