PostgreSQL JDBC + Hibernate lose valuable debug info if an exception is thrown - Mailing list pgsql-jdbc

From Vianen, Jeroen van
Subject PostgreSQL JDBC + Hibernate lose valuable debug info if an exception is thrown
Date
Msg-id F9926D32A30ED511B8E30050044AB52E01F63716@ams010.satama.nl
Whole thread Raw
Responses Re: PostgreSQL JDBC + Hibernate lose valuable debug info if an exception is thrown
Re: PostgreSQL JDBC + Hibernate lose valuable debug info if
List pgsql-jdbc
Hi,

When using Hibernate together with PostgreSQL the following might happen:

- Hibernate uses batched updates
- An exception is thrown (e.g. when a foreign key constraint is violated or
a not null column is left out, etc.)
- This SQLException is wrapped in a PBatchUpdateException
- This PBatchUpdateException is wrapped in a HibernateException
- The HibernateException is written to the log

The problem is that Hibernate uses standard stacktrace print routines with
Root causes as found in JDK 1.4. The call on getNextException() as found in
SQLException is never made and valuable debugging information is lost, e.g.
the actual cause of the BatchUpdateException.

I am wondering whether it is possible to mimic JDK 1.4 root cause exception
handling in PBatchUpdateException so a decent stack trace can be logged.

Hope that this request makes any sense,

Regards,


Jeroen

pgsql-jdbc by date:

Previous
From: Kris Jurka
Date:
Subject: Re: Calling PGSQL Stored function thru JDBC
Next
From: Anders Hermansen
Date:
Subject: Re: PostgreSQL JDBC + Hibernate lose valuable debug info if an exception is thrown