HHH-17463 UnsupportedOperationException when using JAKARTA_JDBC_URL
This commit is contained in:
parent
d5bde15aaa
commit
d90d6e63f0
|
@ -13,6 +13,7 @@ import java.util.Map;
|
||||||
import org.hibernate.boot.registry.BootstrapServiceRegistry;
|
import org.hibernate.boot.registry.BootstrapServiceRegistry;
|
||||||
import org.hibernate.boot.registry.StandardServiceInitiator;
|
import org.hibernate.boot.registry.StandardServiceInitiator;
|
||||||
import org.hibernate.boot.registry.StandardServiceRegistry;
|
import org.hibernate.boot.registry.StandardServiceRegistry;
|
||||||
|
import org.hibernate.cfg.AvailableSettings;
|
||||||
import org.hibernate.service.Service;
|
import org.hibernate.service.Service;
|
||||||
import org.hibernate.service.internal.AbstractServiceRegistryImpl;
|
import org.hibernate.service.internal.AbstractServiceRegistryImpl;
|
||||||
import org.hibernate.service.internal.ProvidedService;
|
import org.hibernate.service.internal.ProvidedService;
|
||||||
|
@ -35,7 +36,7 @@ public class StandardServiceRegistryImpl extends AbstractServiceRegistryImpl imp
|
||||||
BootstrapServiceRegistry bootstrapServiceRegistry,
|
BootstrapServiceRegistry bootstrapServiceRegistry,
|
||||||
Map<String,Object> configurationValues) {
|
Map<String,Object> configurationValues) {
|
||||||
super( bootstrapServiceRegistry, autoCloseRegistry );
|
super( bootstrapServiceRegistry, autoCloseRegistry );
|
||||||
this.configurationValues = configurationValues;
|
this.configurationValues = normalize( configurationValues);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -141,4 +142,38 @@ public class StandardServiceRegistryImpl extends AbstractServiceRegistryImpl imp
|
||||||
super.destroy();
|
super.destroy();
|
||||||
this.configurationValues = null;
|
this.configurationValues = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static Map<String, Object> normalize(Map<String, Object> configurationValues) {
|
||||||
|
final Object jdbcUrl = configurationValues.get( AvailableSettings.JAKARTA_JDBC_URL );
|
||||||
|
if ( jdbcUrl != null ) {
|
||||||
|
configurationValues.putIfAbsent( AvailableSettings.URL, jdbcUrl );
|
||||||
|
}
|
||||||
|
|
||||||
|
final Object username = configurationValues.get( AvailableSettings.JAKARTA_JDBC_USER );
|
||||||
|
if ( username != null ) {
|
||||||
|
configurationValues.putIfAbsent( AvailableSettings.USER, username );
|
||||||
|
}
|
||||||
|
|
||||||
|
final Object password = configurationValues.get( AvailableSettings.JAKARTA_JDBC_PASSWORD );
|
||||||
|
if ( password != null ) {
|
||||||
|
configurationValues.putIfAbsent( AvailableSettings.PASS, password );
|
||||||
|
}
|
||||||
|
|
||||||
|
final Object driver = configurationValues.get( AvailableSettings.JAKARTA_JDBC_DRIVER );
|
||||||
|
if ( driver != null ) {
|
||||||
|
configurationValues.putIfAbsent( AvailableSettings.DRIVER, driver );
|
||||||
|
}
|
||||||
|
|
||||||
|
final Object nonJtaDatasource = configurationValues.get( AvailableSettings.JAKARTA_NON_JTA_DATASOURCE );
|
||||||
|
if ( nonJtaDatasource != null ) {
|
||||||
|
configurationValues.putIfAbsent( AvailableSettings.DATASOURCE, nonJtaDatasource );
|
||||||
|
}
|
||||||
|
|
||||||
|
final Object jtaDatasource = configurationValues.get( AvailableSettings.JAKARTA_JTA_DATASOURCE );
|
||||||
|
if ( jtaDatasource != null ) {
|
||||||
|
configurationValues.putIfAbsent( AvailableSettings.DATASOURCE, jtaDatasource );
|
||||||
|
}
|
||||||
|
|
||||||
|
return configurationValues;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue