How to solve “Batch update returned unexpected row count from update; actual row count: 0; expected: 1” problem?

前端 未结 4 1116
你的背包
你的背包 2021-01-03 18:12

Getting this everytime I attempt to CREATE a particular entity ... just want to know how I should go about figuring out the cause.

I\'m using Fluent NHibernate autom

4条回答
  •  孤街浪徒
    2021-01-03 18:48

    The error means that the SQL INSERT statement is being executed, but the ROWCOUNT being returned by SQL Server after it runs is 0, not 1 as expected.

    There are several causes, from incorrect mappings, to UPDATE/INSERT triggers that have rowcount turned off.

    Your best beat is to profile the SQL statements and see what happens. To do that either turn on nHibernate sql logging, or use the sql profiler. Once you have the SQL you may know the cause, if not try running the SQL manually and see what happens.

    Also I suggest you to post your mapping, as it will help people spot any issues.

提交回复
热议问题