7.1.09

StaleStateException

NHibernate.StaleStateException: Unexpected row count: 0; expected: 1

at NHibernate.AdoNet.Expectations.BasicExpectation.VerifyOutcomeNonBatched(Int32 rowCount, IDbCommand statement)
at NHibernate.AdoNet.NonBatchingBatcher.AddToBatch(IExpectation expectation)
at NHibernate.Persister.Collection.AbstractCollectionPersister.Recreate(IPersistentCollection collection, Object id, ISessionImplementor session)
at NHibernate.Action.CollectionRecreateAction.Execute()
at NHibernate.Engine.ActionQueue.Execute(IExecutable executable)
at NHibernate.Engine.ActionQueue.ExecuteActions(IList list)
at NHibernate.Engine.ActionQueue.ExecuteActions()
at NHibernate.Event.Default.AbstractFlushingEventListener.PerformExecutions(IEventSource session)
at NHibernate.Event.Default.DefaultFlushEventListener.OnFlush(FlushEvent event)
at NHibernate.Impl.SessionImpl.Flush()
at NHibernate.Transaction.AdoTransaction.Commit()
at Zainco.YCW.Tests.Group.AddYCWGroup() in Group.cs: line 70

This usually means that your database is in an inconsistent state(now say that quickly):

UPDATE MyTable SET Description=’xxxx’  WHERE Id=123;

If an updateable record is not found , then the exception above is thrown. Ensure that you have applied the cascade attribute on the relevant associated objects.

No comments: