title: Nhibernate Flush causing Updates where there should be none
body: <p>I am using the Repo pattern, and I have set up tests to replicate my a HTTP request coming in and then causing dispose on a unit of work once a test has completed.</p>
  
  <p>It appears that after executing a HQL statement, and then calling displose (which in turn calls flush) that it is causing an update across various elements.</p>
  
  <p>Very bizzare - has anyone come across this before?</p>
  
  <p>Here is my HQL statement and it's execution:</p>
  
  <pre><code>_session.CreateQuery("select distinct t from TaskEntity as t").List&lt;T&gt;()
  </code></pre>
  
  <p>I've pulled this back to it's simplest form - and note the HQL statement is not directly in the CreateQuery.</p>
  
  <p>Here is the stack trace I am getting:</p>
  
  <p>I</p>
  
  <pre><code>BM.Data.Informix.IfxParameterCollection.b(Int32 A_0)
  IBM.Data.Informix.IfxParameterCollection.GetParameter(Int32 index)
  System.Data.Common.DbParameterCollection.System.Collections.IList.get_Item(Int32 index)
  NHibernate.Type.Int32Type.Set(IDbCommand rs, Object value, Int32 index)
  NHibernate.Type.NullableType.NullSafeSet(IDbCommand cmd, Object value, Int32 index)
  NHibernate.Type.NullableType.NullSafeSet(IDbCommand st, Object value, Int32 index, ISessionImplementor session)
  NHibernate.Persister.Entity.AbstractEntityPersister.Dehydrate(Object id, Object[] fields, Object rowId, Boolean[] includeProperty, Boolean[][] includeColumns, Int32 table, IDbCommand statement, ISessionImplementor session, Int32 index)
  NHibernate.Persister.Entity.AbstractEntityPersister.Update(Object id, Object[] fields, Object[] oldFields, Object rowId, Boolean[] includeProperty, Int32 j, Object oldVersion, Object obj, SqlCommandInfo sql, ISessionImplementor session)
  NHibernate.Persister.Entity.AbstractEntityPersister.UpdateOrInsert(Object id, Object[] fields, Object[] oldFields, Object rowId, Boolean[] includeProperty, Int32 j, Object oldVersion, Object obj, SqlCommandInfo sql, ISessionImplementor session)
  NHibernate.Persister.Entity.AbstractEntityPersister.Update(Object id, Object[] fields, Int32[] dirtyFields, Boolean hasDirtyCollection, Object[] oldFields, Object oldVersion, Object obj, Object rowId, ISessionImplementor session)
  NHibernate.Action.EntityUpdateAction.Execute()
  NHibernate.Engine.ActionQueue.Execute(IExecutable executable)
  NHibernate.Engine.ActionQueue.ExecuteActions(IList list)
  NHibernate.Engine.ActionQueue.ExecuteActions()
  NHibernate.Event.Default.AbstractFlushingEventListener.PerformExecutions(IEventSource session)
  NHibernate.Event.Default.DefaultFlushEventListener.OnFlush(FlushEvent event)
  NHibernate.Impl.SessionImpl.Flush()
  Case.Data.SQL.NHibernateUnitOfWork.Dispose() in C:\Projects\Case System\Dev\WorkingBranch\Src\Case.Data.SQL\NHibernateUnitOfWork.cs: line 46
  Case.Domain.Tests.TaskServicesTests.TakeDown() in C:\Projects\Case System\Dev\WorkingBranch\Src\Case.Domain.Tests\TaskServicesTests.cs: line 40
  </code></pre>