You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Taylor Mathewson <ta...@gmail.com> on 2009/12/22 20:39:20 UTC

Re: Hibernate session should be cleared/flushed between lifecycle methods?

Rather than flushing and or clearing the full session, you can evict that
particular instance.

https://www.hibernate.org/hib_docs/v3/api/org/hibernate/Session.html#evict%28java.lang.Object%29

On Fri, Dec 18, 2009 at 2:40 PM, Everton Agner
<ev...@yahoo.com.br>wrote:

> Hi,
>
> I had a weird situation here and I want to know if it's really a "bug" of
> tapestry hibernate integration or not.
>
> I have a Edit Page. In my onValidate() method, I have already
> instantiated a "current" object (que object I'm editing), and I call a
> BO method for validation. That method load a List of objects (the same
> Type of current, and including itself), and does the validation.
>
> So, In my onSuccess() method, I update my "current" object on Session. But,
> I get a:
>
>  "a different object with the same identifier value was already associated
> with the session:..."
>
> That's because on onValidate() method, I called a BO method that loaded
> a List of objects (including the "current" object), and it was lost in
> memory. So, hibernate can't update it's session data.
>
> My way out of this was calling session.clear() and session.flush() after
> the BO validation method.
>
> So, Tapestry should do that between lifecycle methods to avoid these
> kind of Runtime issues? I don't think it's necessarily a Developer
> matter (as a framework user).
>
> Thanks,
>
> Everton
>
>
>
>
>  ____________________________________________________________________________________
> Veja quais são os assuntos do momento no Yahoo! +Buscados
> http://br.maisbuscados.yahoo.com
>