hakimm
Dec 6th, 2007, 06:58 AM
Hello
I've managed to build a simple jsp application using spring mvc forms taglib, it works but some things are not entirely clear to me :
- is it ok to populate the formBackingObject with database objects before returning it to the view, or should the backing object be empty ?
- when I do the above, I notice initBinder is not called at all, it looks like the form understands how to bind form selections because there already are objects in the formBackingObject : is it a bad idea to rely on this ?
- when I fill the formBackingObject with hibernate pojos, and I change some pojo property with the form, the returned formBackingObject in onSubmit has pojos with their changed property, but hibernate does not see the change (no dirty checking), probably because its session is closed before I display the form, so I have to manually get the changed property, create a transaction, and commit the change : is there another approach to let hibernate session live until onSubmit is over to avoid manual updating ? I'm not a big fan of OSIV because I like to keep control of database lookups, but would it solve my case ?
- more generally, is it ok to fill the formBackingObject with hibernate pojos, or is it safer to fill it with pure pojos, unproxied by cglib, and manually trigger changes ? I understand I'm dealing with proxied objects in the form, but so far it has not caused me problems.
thanks !
I've managed to build a simple jsp application using spring mvc forms taglib, it works but some things are not entirely clear to me :
- is it ok to populate the formBackingObject with database objects before returning it to the view, or should the backing object be empty ?
- when I do the above, I notice initBinder is not called at all, it looks like the form understands how to bind form selections because there already are objects in the formBackingObject : is it a bad idea to rely on this ?
- when I fill the formBackingObject with hibernate pojos, and I change some pojo property with the form, the returned formBackingObject in onSubmit has pojos with their changed property, but hibernate does not see the change (no dirty checking), probably because its session is closed before I display the form, so I have to manually get the changed property, create a transaction, and commit the change : is there another approach to let hibernate session live until onSubmit is over to avoid manual updating ? I'm not a big fan of OSIV because I like to keep control of database lookups, but would it solve my case ?
- more generally, is it ok to fill the formBackingObject with hibernate pojos, or is it safer to fill it with pure pojos, unproxied by cglib, and manually trigger changes ? I understand I'm dealing with proxied objects in the form, but so far it has not caused me problems.
thanks !