NHibernate-Actualizar una tabla con un disparador en ella causa un error-Recuento de filas inesperado: 2; esperado: 1


Así que estoy tratando de actualizar un objeto en mi base de datos MS SQL 2005 usando NHibernate. Tenga en cuenta que esta es una base de datos heredada utilizada en muchos sistemas en vivo y no puedo eliminar los disparadores.

Cuando mi proveedor de datos lo intente .saveOrUpdate() a row I get two returns (one for the actual update, and one when the trigger executes)

El retorno raw se ve así:

(1 fila (s) afectada (s)

(1 fila (s) afectada (s)

NHibernate luego lanza una excepción así: "Número de filas inesperado: 2; esperado: 1"

Esencialmente estoy buscando un equivalente a "ESTABLECER NOCOUNT EN" desde dentro de la sesión.

¿Alguna idea?

Author: David P, 2009-05-05

2 answers

¿Y no puede actualizar el disparador para deshabilitar/habilitar el CONJUNTO NOCOUNT antes/después del código del disparador ?

ESTABLECER NOCOUNT ON -- tu gatillo ESTABLECER NOCOUNT OFF

 32
Author: MatthieuGD,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2009-05-05 00:37:29

NHibernate JIRA NH-1353 proporciona un parche para desactivar el conteo de filas en el archivo de configuración. Parece que este parche no ha llegado a la 2.x baúl.

 2
Author: Jamie Ide,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2014-01-15 23:44:25