Yeah, that's probably the nicest solution. You have to reload your
object every request though, otherwise you'll have your dirty object
still. But that's a good idea with Hibernate objects anyway,
especially when they have lazy relations.

Eelco


On 11/2/05, Igor Vaynberg <[EMAIL PROTECTED]> wrote:
> in a current project i have to do the validation in the service layer, so i
> had the same problem. i use detached objects, and session.merge(). its a
> very clean solution and works great so far.
>
>  basic idea is: when creating an edit page load the object from database and
> set it as form model. when the form is submitted - the loaded object becomes
> detached because its session was closed when the prev request was done. let
> the form bean the changes. call the service validate method - if everything
> is OK - call the service merge method which uses session.merge to save the
> changes.
>
>  checkout wicket-phonebook - it also works like that bar the validation.
>
>  -Igor
>
>
> On 11/2/05, Phil Kulak <[EMAIL PROTECTED]> wrote:
> > I know we've talked about this before, but now I need to do it and I
> > have no clue. The easiest thing, of course, would be to just let the
> > models get updated, do my validation, and report any errors back to
> > the user. The problem is that if I let the models get changed, then
> > Hibernate get's all excited and automatically updates the database at
> > the end of the request. Has anyone hit this problem before?
> >
> >
> > -------------------------------------------------------
> > SF.Net email is sponsored by:
> > Tame your development challenges with Apache's Geronimo App Server.
> Download
> > it for free - -and be entered to win a 42" plasma tv or your very own
> > Sony(tm)PSP.  Click here to play:
> http://sourceforge.net/geronimo.php
> > _______________________________________________
> > Wicket-develop mailing list
> > [email protected]
> >
> https://lists.sourceforge.net/lists/listinfo/wicket-develop
> >
>
>


-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
Wicket-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-develop

Reply via email to