[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-3543) method org.hibernate.transaction.JDBCTransaction.notifyLocalSynchsBeforeTransactionCompletion "swallows" all exceptions occured inside it

Krasimir Chobantonov (JIRA) noreply at atlassian.com
Tue Feb 17 22:28:38 EST 2009


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-3543?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=32440#action_32440 ] 

Krasimir Chobantonov commented on HHH-3543:
-------------------------------------------

I have the same problem but with different hibernate listener (Hibernate Audit)

Workaround of this problem if using slf4j + log4j is the following  ( the code needs to be executed when the hibernate & log4j are initialized)

    private static final org.apache.log4j.Logger JDBC_TRANSACTION_LOG = org.apache.log4j.Logger.getLogger(JDBCTransaction.class);

    // method that will call interceptLog()

    private void interceptLog() {
        if (Level.OFF.equals(JDBC_TRANSACTION_LOG.getLevel())) {
            JDBC_TRANSACTION_LOG.setLevel(Level.ERROR);
        }

        JDBC_TRANSACTION_LOG.addAppender(new AppenderSkeleton() {
            @Override
            public boolean requiresLayout() {
                return false;
            }

            @Override
            public void close() {
            }

            @Override
            protected void append(LoggingEvent event) {
                if (event.getThrowableInformation().getThrowable() instanceof ExceptionToPass) {
                    throw (ExceptionToPass) event.getThrowableInformation().getThrowable();
                }
            }
        });
    }

Where ExceptionToPass is a runtime exception that is thrown by your listener.

Krasimir


> method org.hibernate.transaction.JDBCTransaction.notifyLocalSynchsBeforeTransactionCompletion "swallows" all exceptions occured inside it
> -----------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HHH-3543
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3543
>             Project: Hibernate Core
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 3.3.1
>         Environment: MS Windows XP SP2, JDK 1.6.8, Eclipse 3.2.0
>            Reporter: Roman
>   Original Estimate: 4 days
>  Remaining Estimate: 4 days
>
> When using JBoss Envers any exceptions occured during saving data into version tables are swallowed by code block in class org.hibernate.transaction.JDBCTransaction (line 273):
>                                 try {
> 					sync.beforeCompletion();
> 				}
> 				catch (Throwable t) {
> 					log.error("exception calling user Synchronization", t);
> 				}
> Thereby, any exceptions occured in sync.beforeCompletion() will only be shown in log, but will not have any effect on application functionality
> So I have such behaviour:
> 1. Entity changes are saved in database by hibernate
> 2. Version tables for entities are empty, because, for example, of invalid column names
> 3. Transaction commits successfully.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the hibernate-issues mailing list