any entity (object) that is fetched from the db with nhibernate
becomes associated with the nhibernate isession that fetched it, eg.

            ISession session = sessionFactory.OpenSession();
            var album = session.Get<Album>(id); // album is now
associated with session
            //... do something to album ....
            ISession session2 = sessionFactory.OpenSession();
            session2.Update(album); // this is illegal.

You should manage your sessions.
This is a broader article, but it is on the point..
http://msdn.microsoft.com/en-us/magazine/ee819139.aspx

Best regards.

On Mar 29, 9:41 am, Munira <[email protected]> wrote:
> Hello all,
>
> We encounter the following exception
> "illegal attempt to associate a collection with two open sessions
> nhibernate"
>
> While trying to update and object. The object is an item in an IList
> collection. We loop through the collection and try to Update each
> object in the collection. The very first object update itself fails
> throwing the above mentioned error.
>
> I would be grateful for any idea or response!

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

Reply via email to