Is there a particular reason you are using Session.lock(Object, LockMode)?
To reattach an object, you can simply use the Session.update(Object) method
on the Hibernate Session.


On 3/27/06, Henri Dupre <[EMAIL PROTECTED]> wrote:
>
> I'm getting periodically these Hibernate exceptions:
> org.hibernate.HibernateException: illegally attempted to associate a proxy
> with two open Sessions
> and one of my theory is this is due to my procedure that reconnects all my
> hibernate objects in my Visit object to the current session. I do this
> usually at the beginning of each request.
> My Visit object has a reconnect(Session session) method that does a
> lock(object, LockMode.NONE) to each Hiberante object in there.
> But I believe that sometimes some users are able to span two requests at
> the
> same time on the server... I bet that both requests are going to get the
> same Visit object, and then both objects are going to do a "reconnect" and
> both succeed in getting reconnected to a new session... And the Hibernate
> evilness then happens only at the next flush which is going to fail and I
> bet throws this exception.
>
> I'm not sure how to solve this problem in a clean way... Would it be
> possible in Tapestry 4 to add somekind of attach and detach methods to my
> visit object and let the engine or a filter call them? this way I could
> make
> sure that no other session is attached to the visit object before
> attaching
> them.
>
>
> Thanks,
>
> Henri.
>
>

Reply via email to