You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Nils Liebelt <ni...@candor.co.za> on 2005/05/13 11:30:53 UTC

Creating/Editing of business objects :: Best practise

Hi all,

 

I am just wondering who you guys handle the different save operations when
creating/editing any business object. I see two options:

 

-                      Put an id into ActionForm

-                      Retrieve the business object with that id 

-                      Update businessobject

 

Or what also could be interesting

 

-                      No id in the ActionForm or just getter

-                      When preparing the edit view put the corresponding
businessobject into the session

-                      When saving you lookup if that businessobject exists
and use it.

-                      Update businessobject

 

The first option has to retireve the businessobject twice. Well, this
shouldn't be a problem in cached environment. 

But you have the id in the Form. So you gotta do all sorts of checks,
whether its an id, if it's an proper id.. 

I am going for the approach right now but I am not really happy with it. 

 

 

GreetZ

 

Nils