These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: "reassociated object has dirty collection" for laz
PostPosted: Tue Sep 12, 2006 9:45 am 
Beginner
Beginner

Joined: Tue Mar 14, 2006 9:15 am
Posts: 20
Location: Bitonto (BA) Italy
I have a Order class with two one-to-many relations with lazy = "true".

I load an order, then I have:

//client code
order.Details1.Add(detail); //now the collection is dirty

order.Details2.Count --> throws HibernateException("reassociated object has dirty collection")

This happens when the LazyLoad method tries to attach the second collection to the order object. Tthe property Snapshot.Dirty after adding the detail is set to true.


//extract of lazy load method...

Code:
if (!NHibernateUtil.IsInitialized(nativeColl))
{
   openSession();
   _session.Lock(item, LockMode.None);
   NHibernateUtil.Initialize(nativeColl);
   closeSession();
}


Hibernate version: 1.0.2

Full stack trace of any exception that occurs:

at NHibernate.Impl.OnLockVisitor.ProcessCollection(Object collection, PersistentCollectionType type)
at NHibernate.Impl.AbstractVisitor.ProcessValue(Object value, IType type)
at NHibernate.Impl.AbstractVisitor.ProcessValues(Object[] values, IType[] types)
at NHibernate.Impl.AbstractVisitor.Process(Object obj, IClassPersister persister)
at NHibernate.Impl.SessionImpl.Reassociate(Object obj, Object id, IClassPersister persister)
at NHibernate.Impl.SessionImpl.Lock(Object obj, LockMode lockMode)
at Persistence.Repository.ReconnectSession(ItemBase item, IList nativeColl) in D:\...\BackEnd\Repository\Repository.cs:line 469


Name and version of the database you are using:
SQL SERVER 2000
Code:


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.