Unexpected row count deleting already-triggered base class table row

10 views
Skip to first unread message

Michael Powell

unread,
Sep 4, 2016, 5:57:50 PM9/4/16
to fluent-n...@googlegroups.com
Hello,

I've got a table per class domain model with a hierarchy going on.
What I am finding is that the error: "Batch update returned unexpected
row count from update; actual row count: 0; expected: 1", is
happening. This is because I am having the database delete the base
class table record triggered on deleting the child class from its
table, which ends up with the indicated error. I'd like to do the
bookkeeping in the database if at all possible, but if I need to defer
that to the domain model, then so be it. I just wonder if there is a
clean way to handle that through the fluent mappings signaling
deletion activities.

Thanks!

Thank you...

Regards,

Michael Powell

Michael Powell

unread,
Sep 4, 2016, 6:05:08 PM9/4/16
to fluent-n...@googlegroups.com
For example, perhaps something in the following call(s):

//...
Extends<DomainModelBase>();
//...

I'd like to let the database handle the "abstraction" as I mentioned,
but I wonder if something like a SqlDelete() would be more appropriate
than letting NHibernate determine the classes/tables that require
deletion.

As a last resort I will take the after delete trigger out of the child
class triggers, but only as a last resort, as I believe the database
should be handling this sort of integrity, with the ORM being a thin
vernier, best case.
Reply all
Reply to author
Forward
0 new messages