Note that there are some explanatory texts on larger screens.

plurals
  1. POCall getNextException to see the cause : How to make Hibernate / JPA show the DB server message for an exception
    primarykey
    data
    text
    <p>I am using Postgresql, Hibernate and JPA. Whenever there is an exception in the database, I get something like this which is not very helpful as it does not show what really went wrong on the DB server.</p> <pre><code>Caused by: java.sql.BatchUpdateException: Batch entry 0 update foo set ALERT_FLAG='3' was aborted. Call getNextException to see the cause. at org.postgresql.jdbc2.AbstractJdbc2Statement$BatchResultHandler.handleError(AbstractJdbc2Statement.java:2621) at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1837) at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:407) at org.postgresql.jdbc2.AbstractJdbc2Statement.executeBatch(AbstractJdbc2Statement.java:2754) at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeBatch(NewProxyPreparedStatement.java:1723) at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:70) at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:268) ... 82 more </code></pre> <p>I want the exception message from the database to appear in the application's log.</p> <p>I came across <a href="http://erics-notes.blogspot.in/2008/03/java-sqlexception-chaining.html" rel="noreferrer">this article</a> which uses an Aspect to populate the exception chain which is otherwise not populated properly in case of SQLExceptions.</p> <p>Is there a way to fix this without using Aspects or any custom code. Ideal solution would involve only config file changes.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload