mirror of
https://github.com/hibernate/hibernate-orm
synced 2025-02-14 23:25:00 +00:00
don't swallow connection errors
This bug made it *really* hard to figure out what was going on with rejected connections!
This commit is contained in:
parent
b085730dd8
commit
42de2976e1
@ -19,6 +19,7 @@
|
|||||||
import org.hibernate.exception.spi.SQLExceptionConversionDelegate;
|
import org.hibernate.exception.spi.SQLExceptionConversionDelegate;
|
||||||
import org.hibernate.exception.spi.ViolatedConstraintNameExtracter;
|
import org.hibernate.exception.spi.ViolatedConstraintNameExtracter;
|
||||||
import org.hibernate.internal.util.ValueHolder;
|
import org.hibernate.internal.util.ValueHolder;
|
||||||
|
import org.hibernate.service.spi.ServiceException;
|
||||||
import org.hibernate.service.spi.ServiceRegistryImplementor;
|
import org.hibernate.service.spi.ServiceRegistryImplementor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -112,10 +113,15 @@ public JDBCException convert(SQLException sqlException, String message, String s
|
|||||||
);
|
);
|
||||||
|
|
||||||
protected JDBCException convertSqlException(String message, SQLException e) {
|
protected JDBCException convertSqlException(String message, SQLException e) {
|
||||||
// if JdbcServices#getSqlExceptionHelper is available, use it...
|
try {
|
||||||
final JdbcServices jdbcServices = serviceRegistry.getService( JdbcServices.class );
|
// if JdbcServices#getSqlExceptionHelper is available, use it...
|
||||||
if ( jdbcServices != null && jdbcServices.getSqlExceptionHelper() != null ) {
|
final JdbcServices jdbcServices = serviceRegistry.getService( JdbcServices.class );
|
||||||
return jdbcServices.getSqlExceptionHelper().convert( e, message, null );
|
if ( jdbcServices != null && jdbcServices.getSqlExceptionHelper() != null ) {
|
||||||
|
return jdbcServices.getSqlExceptionHelper().convert( e, message, null );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (ServiceException se) {
|
||||||
|
//swallow it because we're in the process of initializing JdbcServices
|
||||||
}
|
}
|
||||||
|
|
||||||
// likely we are still in the process of initializing the ServiceRegistry, so use the simplified
|
// likely we are still in the process of initializing the ServiceRegistry, so use the simplified
|
||||||
|
Loading…
x
Reference in New Issue
Block a user