mirror of
https://github.com/hibernate/hibernate-orm
synced 2025-02-12 22:24:47 +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.ViolatedConstraintNameExtracter;
|
||||
import org.hibernate.internal.util.ValueHolder;
|
||||
import org.hibernate.service.spi.ServiceException;
|
||||
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) {
|
||||
// if JdbcServices#getSqlExceptionHelper is available, use it...
|
||||
final JdbcServices jdbcServices = serviceRegistry.getService( JdbcServices.class );
|
||||
if ( jdbcServices != null && jdbcServices.getSqlExceptionHelper() != null ) {
|
||||
return jdbcServices.getSqlExceptionHelper().convert( e, message, null );
|
||||
try {
|
||||
// if JdbcServices#getSqlExceptionHelper is available, use it...
|
||||
final JdbcServices jdbcServices = serviceRegistry.getService( JdbcServices.class );
|
||||
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
|
||||
|
Loading…
x
Reference in New Issue
Block a user