NH need to check the rowcount to ensure the delete action was
performed successfully.

2009/7/28 Hfern <[email protected]>

>
> well it is a stored procedure which has a single parameter of the ID
>
> <sql-delete>exec sp_DeletePriceSetup ?</sql-delete>
>
>
> On Jul 28, 3:19 pm, Fabio Maulo <[email protected]> wrote:
> > which stored procedure?
> >
> > 2009/7/28 Hfern <[email protected]>
> >
> >
> >
> >
> >
> >
> >
> > > I am using version 1.2.1.400 of Nhibernate
> > > while trying to delete a row from the database I get the following
> > > error.The row does get deleted
> > > [NHibernate.StaleStateException]        {"Unexpected row count: -1;
> > > expected:
> > > 1"}
> >
> > > here is the stack trace
> > > ---------------------------------
> > > at
> > > NHibernate.AdoNet.Expectations.BasicExpectation.VerifyOutcomeNonBatched
> > > (Int32 rowCount, IDbCommand statement) at
> > > NHibernate.AdoNet.NonBatchingBatcher.AddToBatch(IExpectation
> > > expectation) at
> > > NHibernate.Persister.Entity.AbstractEntityPersister.Delete(Object id,
> > > Object version, Int32 j, Object obj, SqlCommandInfo sql,
> > > ISessionImplementor session, Object[] loadedState) at
> > > NHibernate.Persister.Entity.AbstractEntityPersister.Delete(Object id,
> > > Object version, Object obj, ISessionImplementor session) at
> > > NHibernate.Action.EntityDeleteAction.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
> >
> > > code snippet
> > > ---------------
> > > ISession session = factory.OpenSession();
> > > ITransaction transaction = session.BeginTransaction();
> >
> > > session.BeginTransaction(0);
> > > session.delete(instance) /// instance is the row object that I am
> > > trying to delte
> > > transaction.commit
> > > session.Close();
> >
> > > I have SET NOCOUNT ON in the stored procedure
> > > Is this a bug in NHibernate
> >
> > --
> > Fabio Maulo- Hide quoted text -
> >
> > - Show quoted text -
> >
>


-- 
Fabio Maulo

--~--~---------~--~----~------------~-------~--~----~
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