From: Michael D. <mik...@us...> - 2004-05-24 20:52:57
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Impl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16202/NHibernate/Impl Modified Files: ScheduledUpdate.cs SessionImpl.cs Log Message: Fixed problems with an unneeded Update being issued before a Delete. Index: SessionImpl.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Impl/SessionImpl.cs,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** SessionImpl.cs 20 May 2004 20:59:19 -0000 1.26 --- SessionImpl.cs 24 May 2004 20:52:47 -0000 1.27 *************** *** 2279,2302 **** } ! private void Execute() { ! log.Debug("executing flush"); ! try { ExecuteAll( insertions ); - ExecuteAll( updates ); - ExecuteAll( collectionRemovals ); - ExecuteAll( collectionUpdates ); - ExecuteAll( collectionCreations ); - ExecuteAll( deletions ); - - // have to do this here because ICollection does not have a remove method insertions.Clear(); updates.Clear(); collectionRemovals.Clear(); collectionUpdates.Clear(); collectionCreations.Clear(); deletions.Clear(); ! } catch (Exception e) { throw new ADOException("could not synchronize database state with session", e); } --- 2279,2310 ---- } ! private void Execute() ! { log.Debug("executing flush"); ! try ! { ! // see the comments in ExecuteAll for why the Clear() has been added here... ExecuteAll( insertions ); insertions.Clear(); + + ExecuteAll( updates ); updates.Clear(); + + ExecuteAll( collectionRemovals ); collectionRemovals.Clear(); + + ExecuteAll( collectionUpdates ); collectionUpdates.Clear(); + + ExecuteAll( collectionCreations ); collectionCreations.Clear(); + + ExecuteAll( deletions ); deletions.Clear(); ! ! } ! catch (Exception e) ! { throw new ADOException("could not synchronize database state with session", e); } *************** *** 2331,2337 **** executions.Add(e); e.Execute(); ! //TODO: h2.0.3 has this but not NH // iter.remove -> coll.Remove()?? } if ( batcher!=null ) batcher.ExecuteBatch(); } --- 2339,2347 ---- executions.Add(e); e.Execute(); ! // this was moved to Execute because there is no way to ! // remove an item from an enumerator... // iter.remove -> coll.Remove()?? } + if ( batcher!=null ) batcher.ExecuteBatch(); } Index: ScheduledUpdate.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Impl/ScheduledUpdate.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ScheduledUpdate.cs 28 Mar 2004 06:08:10 -0000 1.3 --- ScheduledUpdate.cs 24 May 2004 20:52:47 -0000 1.4 *************** *** 22,26 **** } ! public ScheduledUpdate(object id, object[] fields, int[] dirtyProperties, object lastVersion, object nextVersion, object instance, object[] updateState, IClassPersister persister, ISessionImplementor session) : base(session, id, instance, persister) { this.fields = fields; --- 22,26 ---- } ! public ScheduledUpdate(object id, object[] fields, int[] dirtyProperties, object lastVersion, object nextVersion, object instance, object[] updatedState, IClassPersister persister, ISessionImplementor session) : base(session, id, instance, persister) { this.fields = fields; |