Both methods have the same effect. The attachement of models is hidden
in the models, not in the components. Detachement is done by
components after rendering. Preferably is getModelObject, but just
because it is shorter and it hides getting the model.
What happens in that request is that first th
So something like this?public void onSubmit() { Foo f = (Foo) getModelObject(); ...}or like: public void onSubmit() { Foo f = (Foo) getModel().getObject(null); ...}
Because the first one refreshes the object from the database. On 7/31/06, Eelco Hillenius <[EMAIL PROTECTED]
> wrote:After succes
After successful validation, you should update the database with the
object that is in your detachable model. They should be in sync then.
If for some reason, you need to read in the value fresh in the same
request, just call detach on that model to ensure next time it is read
it will first re-load
But that's not the behavior I'm seeing. On successful validation, the model object is refreshed from the database after the form updates the model object, clobbering the user-entered data.
On 7/31/06, Eelco Hillenius <[EMAIL PROTECTED]> wrote:
Yeah, those models are typically perfect for doing d
Yeah, those models are typically perfect for doing database stuff. The
only thing is that if all validations pass, you should update the
database. But that's usually exactly what you want, right? If
validation fails, the model is indeed reloaded from the database, but
that's not something that is i
Is it possible to use a LoadableDetachableModel with a Form? The problem I'm running into is the following:1) Create the Form with: new Form("form", new CompoundPropertyModel(new MyDetachableModel(fooId, fooService)));
2) Present the page to the user for editing. The user edits the fields and sub