Patches always welcome when attached to JIRA issues. 

-Steve B. 
-----Original Message-----
From: Gena <[email protected]>
Sender: [email protected]
Date: Fri, 22 Jul 2011 06:09:09 
To: nhibernate-development<[email protected]>
Reply-To: [email protected]
Subject: [nhibernate-development] DbException.Data["actual-sql-query"] is lost
 in exceptions tree on its way to logging

I have a custom version of batcher implemented, derived from
AbstractBatcher where I'm making sure that DbException is correctly
catched and exception.Data["actual-sql-query"] is assigned to a full
query string so that I can see it in the log (in the same way as it is
done in AbstactBatcher, search for "actual-sql-query").

The problem is that AbstractEntityPersister catches all DbExceptions
and then it creates a new exception with a help of ADOExceptionHelper.
But on the way it overrides my query with its own one in a form:

"SQL: DELETE FROM features WHERE id = ?].

As a result I'm missing actual value in "id=?" in the log. In my
"actual-sql-query" SQL string is defined as:

"DELETE FROM features WHERE id = @p0; Parameter Values: @p0=6"

which is a bit more informative.

Looks like a small inconsistency to me. AbstractEntityPersister
probably should pass on "actual-sql-query" if it is defined instead of
skipping it. Or at least it should log actual id.



Reply via email to