You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by mfaine <mf...@knology.net> on 2005/02/11 14:37:04 UTC

Best Practice, saving state

In a web application I am writing a user edits an object in a multi-step
process.  What would be the best practice of the two:

A.  Save and Restore the state to/from the database at each step.
B.  Save and Restore the state to/from the session and only save to the
database at the end of the process.

Thanks,
-Mark


Re: Best Practice, saving state

Posted by Sean Schofield <se...@gmail.com>.
Mark,

You might want to think about saving to the client/session using the
JSF state.  This way if the user abandons the process you don't have
incomplete/orphaned records in the database.

Think about the nature of the data.  Is there one or two objects that
you could conceptually think of this data belonging to (ex. user,
reservation, document.)  If so, then these could just be session scope
backing beans that you use between requests of your process.  You
could even remove the bean from the session when you were done.

It depends on your situation of course.  There would be times where
saving to a database might be more appropriate.

sean


On Fri, 11 Feb 2005 05:37:14 -0800 (PST), mfaine <mf...@knology.net> wrote:
> In a web application I am writing a user edits an object in a multi-step
> process.  What would be the best practice of the two:
> 
> A.  Save and Restore the state to/from the database at each step.
> B.  Save and Restore the state to/from the session and only save to the
> database at the end of the process.
> 
> Thanks,
> -Mark
> 
>