HHH-12392 - Caching SchemaResolver delegate with multiple data sources
This commit is contained in:
parent
dcc188efc5
commit
d893386f96
|
@ -34,7 +34,6 @@ public class DefaultSchemaNameResolver implements SchemaNameResolver {
|
|||
}
|
||||
|
||||
private void determineAppropriateResolverDelegate(Connection connection) {
|
||||
if ( delegate == null ) {
|
||||
// unfortunately Connection#getSchema is only available in Java 1.7 and above
|
||||
// and Hibernate still baselines on 1.6. So for now, use reflection and
|
||||
// leverage the Connection#getSchema method if it is available.
|
||||
|
@ -46,7 +45,7 @@ public class DefaultSchemaNameResolver implements SchemaNameResolver {
|
|||
// If the JDBC driver does not implement the Java 7 spec, but the JRE is Java 7
|
||||
// then the getSchemaMethod is not null but the call to getSchema() throws an java.lang.AbstractMethodError
|
||||
connection.getSchema();
|
||||
delegate = new SchemaNameResolverJava17Delegate( );
|
||||
delegate = new SchemaNameResolverJava17Delegate();
|
||||
}
|
||||
catch (java.lang.AbstractMethodError e) {
|
||||
log.debugf( "Unable to use Java 1.7 Connection#getSchema" );
|
||||
|
@ -59,8 +58,10 @@ public class DefaultSchemaNameResolver implements SchemaNameResolver {
|
|||
}
|
||||
}
|
||||
catch (Exception ignore) {
|
||||
log.debugf( "Unable to resolve connection default schema : " + ignore.getMessage() );
|
||||
}
|
||||
log.debugf(
|
||||
"Unable to use Java 1.7 Connection#getSchema : An error occurred trying to resolve the connection default schema resolver: "
|
||||
+ ignore.getMessage() );
|
||||
delegate = SchemaNameResolverFallbackDelegate.INSTANCE;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue