Scott F. Walter <scott.walter <at> vivare.com> writes:

> 
> For the record I am using Hibernate/Tapestry/Spring with the Spring 
> OpenViewInSession Filter.
> 
> I have an object that is stored in my Visit object that contains a lazy 
> collection.  On a page inside the pageBeginRenderer, I attempt to access 
> the lazy collection and I get the standard "Failed to lazily initialize 
> a collection - no session or session was closed" exception.  So right 
> before the code I access the collection I attempt to reattach the object 
> in the Visit with the Hibernate lock method.  This time I get the 
> exception "NonUniqueObjectException: a different object with the same 
> identifier value was already associated with the session
> 
> I am in a catch 22.  First Hibernate tells me I'm not in a session, but 
> when I try to bring the object into the session it tells me that I'm 
> already in the session?
> 
> Any clues or suggesions.
> 

This might also come from not properly set up obj.hashCode() and obj.equals() 
methods. In Hibernate, these *must* be paired (two equal objects must give same 
hash), and they cannot use the database primary key for comparison. This makes 
it kind of difficult sometimes. 
http://www.hibernate.org/109.html

Hope this helps...


-- 
Olve


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to