@Override public ExceptionConverter getExceptionConverter() { return delegate.getExceptionConverter(); }
@Override public RuntimeException mapManagedFlushFailure(String message, RuntimeException failure, SessionImplementor session) { if ( HibernateException.class.isInstance( failure ) ) { throw session.getExceptionConverter().convert( failure ); } if ( PersistenceException.class.isInstance( failure ) ) { throw failure; } throw new PersistenceException( message, failure ); } }
@Override public ExceptionConverter getExceptionConverter() { return delegate.getExceptionConverter(); }
@Override public ExceptionConverter getExceptionConverter() { return getSessionImplementor().getExceptionConverter(); }
@Override public RuntimeException mapManagedFlushFailure(String message, RuntimeException failure, SessionImplementor session) { if ( HibernateException.class.isInstance( failure ) ) { throw session.getExceptionConverter().convert( failure ); } if ( PersistenceException.class.isInstance( failure ) ) { throw failure; } throw new PersistenceException( message, failure ); } }
/** * Force the session to flush, but don't throw an exception if performed outside of a transaction. * * @param session the Session object * @throws org.hibernate.HibernateException Indicates problems flushing the session or talking to the database */ public static void flushAllowNoTransaction(final Session session) throws HibernateException { SessionImplementor sessionImplementor = (SessionImplementor) session; errorIfClosed(sessionImplementor); try { if (sessionImplementor.getPersistenceContext().getCascadeLevel() > 0) { throw new HibernateException("Flush during cascade is dangerous"); } FlushEvent flushEvent = new FlushEvent((EventSource) sessionImplementor); for (final FlushEventListener listener : eventListenerGroup(session, EventType.FLUSH).listeners()) { listener.onFlush(flushEvent); } } catch (RuntimeException e) { throw sessionImplementor.getExceptionConverter().convert(e); } }