Ok, will submit an issue / patch. Though it will be good to post it
first since I had no idea about what is agreed style to throw/rethrow
exceptions.

Converter - yep, saw it. But that's for extending NHibernate. I guess
default behaviour should also work.

Thanks.

On Jul 22, 5:01 pm, Fabio Maulo <[email protected]> wrote:
> Steve,
> does he know about our injectable ISQLExceptionConverter ?
> Usage examples available in:
> NHibernate.Test.ExceptionsTest
> Implementation example :
> NHibernate.Test.ExceptionsTest.MSSQLExceptionConverterExample
> NHibernate.Test.ExceptionsTest.OracleClientExceptionConverterExample
> NHibernate.Test.ExceptionsTest.PostgresExceptionConverterExample
>
> Old style configuration by code:
> configuration.SetProperty(Cfg.Environment.SqlExceptionConverter,
> typeof (MSSQLExceptionConverterExample).AssemblyQualifiedName);
>
> New style configuration by code:
> configure.DataBaseIntegration(db =>
>                                {
>                                db.Dialect<MsSql2000Dialect>();
>                                db.ExceptionConverter<
> MSSQLExceptionConverterExample>();
>                                });
>
>
>
>
>
>
>
>
>
> On Fri, Jul 22, 2011 at 11:28 AM, Stephen Bohlen <[email protected]> wrote:
> > 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.
>
> --
> Fabio Maulo

Reply via email to