HHH-18205 respect property-configured naming strategies in Configuration
and make the state model more transparent Signed-off-by: Gavin King <gavin@hibernate.org>
This commit is contained in:
parent
caa0ae845d
commit
407e57d442
|
@ -37,9 +37,7 @@ import org.hibernate.boot.model.convert.internal.ClassBasedConverterDescriptor;
|
||||||
import org.hibernate.boot.model.convert.internal.InstanceBasedConverterDescriptor;
|
import org.hibernate.boot.model.convert.internal.InstanceBasedConverterDescriptor;
|
||||||
import org.hibernate.boot.model.convert.spi.ConverterDescriptor;
|
import org.hibernate.boot.model.convert.spi.ConverterDescriptor;
|
||||||
import org.hibernate.boot.model.naming.ImplicitNamingStrategy;
|
import org.hibernate.boot.model.naming.ImplicitNamingStrategy;
|
||||||
import org.hibernate.boot.model.naming.ImplicitNamingStrategyJpaCompliantImpl;
|
|
||||||
import org.hibernate.boot.model.naming.PhysicalNamingStrategy;
|
import org.hibernate.boot.model.naming.PhysicalNamingStrategy;
|
||||||
import org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl;
|
|
||||||
import org.hibernate.boot.model.relational.AuxiliaryDatabaseObject;
|
import org.hibernate.boot.model.relational.AuxiliaryDatabaseObject;
|
||||||
import org.hibernate.boot.model.relational.ColumnOrderingStrategy;
|
import org.hibernate.boot.model.relational.ColumnOrderingStrategy;
|
||||||
import org.hibernate.boot.query.NamedHqlQueryDefinition;
|
import org.hibernate.boot.query.NamedHqlQueryDefinition;
|
||||||
|
@ -129,7 +127,8 @@ public class Configuration {
|
||||||
|
|
||||||
private final BootstrapServiceRegistry bootstrapServiceRegistry;
|
private final BootstrapServiceRegistry bootstrapServiceRegistry;
|
||||||
private final MetadataSources metadataSources;
|
private final MetadataSources metadataSources;
|
||||||
private final ClassmateContext classmateContext;
|
final private StandardServiceRegistryBuilder standardServiceRegistryBuilder;
|
||||||
|
private final ClassmateContext classmateContext = new ClassmateContext();
|
||||||
|
|
||||||
// used during processing mappings
|
// used during processing mappings
|
||||||
private ImplicitNamingStrategy implicitNamingStrategy;
|
private ImplicitNamingStrategy implicitNamingStrategy;
|
||||||
|
@ -138,11 +137,11 @@ public class Configuration {
|
||||||
private List<UserTypeRegistration> userTypeRegistrations;
|
private List<UserTypeRegistration> userTypeRegistrations;
|
||||||
private final List<TypeContributor> typeContributorRegistrations = new ArrayList<>();
|
private final List<TypeContributor> typeContributorRegistrations = new ArrayList<>();
|
||||||
private final List<FunctionContributor> functionContributorRegistrations = new ArrayList<>();
|
private final List<FunctionContributor> functionContributorRegistrations = new ArrayList<>();
|
||||||
private Map<String, NamedHqlQueryDefinition> namedQueries;
|
private final Map<String, NamedHqlQueryDefinition> namedQueries = new HashMap<>();
|
||||||
private Map<String, NamedNativeQueryDefinition> namedSqlQueries;
|
private final Map<String, NamedNativeQueryDefinition> namedSqlQueries = new HashMap<>();
|
||||||
private Map<String, NamedProcedureCallDefinition> namedProcedureCallMap;
|
private final Map<String, NamedProcedureCallDefinition> namedProcedureCallMap = new HashMap<>();
|
||||||
private Map<String, NamedResultSetMappingDescriptor> sqlResultSetMappings;
|
private final Map<String, NamedResultSetMappingDescriptor> sqlResultSetMappings = new HashMap<>();
|
||||||
private Map<String, NamedEntityGraphDefinition> namedEntityGraphMap;
|
private final Map<String, NamedEntityGraphDefinition> namedEntityGraphMap = new HashMap<>();
|
||||||
|
|
||||||
private Map<String, SqmFunctionDescriptor> customFunctionDescriptors;
|
private Map<String, SqmFunctionDescriptor> customFunctionDescriptors;
|
||||||
private List<AuxiliaryDatabaseObject> auxiliaryDatabaseObjectList;
|
private List<AuxiliaryDatabaseObject> auxiliaryDatabaseObjectList;
|
||||||
|
@ -150,15 +149,14 @@ public class Configuration {
|
||||||
private List<EntityNameResolver> entityNameResolvers = new ArrayList<>();
|
private List<EntityNameResolver> entityNameResolvers = new ArrayList<>();
|
||||||
|
|
||||||
// used to build SF
|
// used to build SF
|
||||||
private StandardServiceRegistryBuilder standardServiceRegistryBuilder;
|
private Properties properties = new Properties();
|
||||||
|
private Interceptor interceptor = EmptyInterceptor.INSTANCE;
|
||||||
private EntityNotFoundDelegate entityNotFoundDelegate;
|
private EntityNotFoundDelegate entityNotFoundDelegate;
|
||||||
private Interceptor interceptor;
|
|
||||||
private SessionFactoryObserver sessionFactoryObserver;
|
private SessionFactoryObserver sessionFactoryObserver;
|
||||||
private StatementInspector statementInspector;
|
private StatementInspector statementInspector;
|
||||||
private CurrentTenantIdentifierResolver<Object> currentTenantIdentifierResolver;
|
private CurrentTenantIdentifierResolver<Object> currentTenantIdentifierResolver;
|
||||||
private CustomEntityDirtinessStrategy customEntityDirtinessStrategy;
|
private CustomEntityDirtinessStrategy customEntityDirtinessStrategy;
|
||||||
private ColumnOrderingStrategy columnOrderingStrategy;
|
private ColumnOrderingStrategy columnOrderingStrategy;
|
||||||
private Properties properties;
|
|
||||||
private SharedCacheMode sharedCacheMode;
|
private SharedCacheMode sharedCacheMode;
|
||||||
|
|
||||||
@Deprecated(since = "6", forRemoval = true)
|
@Deprecated(since = "6", forRemoval = true)
|
||||||
|
@ -179,10 +177,10 @@ public class Configuration {
|
||||||
* and a newly instantiated {@link MetadataSources}.
|
* and a newly instantiated {@link MetadataSources}.
|
||||||
*/
|
*/
|
||||||
public Configuration(BootstrapServiceRegistry serviceRegistry) {
|
public Configuration(BootstrapServiceRegistry serviceRegistry) {
|
||||||
this.bootstrapServiceRegistry = serviceRegistry;
|
bootstrapServiceRegistry = serviceRegistry;
|
||||||
this.metadataSources = new MetadataSources( serviceRegistry, createMappingBinderAccess( serviceRegistry ) );
|
metadataSources = new MetadataSources( serviceRegistry, createMappingBinderAccess( serviceRegistry ) );
|
||||||
this.classmateContext = new ClassmateContext();
|
standardServiceRegistryBuilder = new StandardServiceRegistryBuilder( bootstrapServiceRegistry );
|
||||||
reset();
|
properties.putAll( standardServiceRegistryBuilder.getSettings() );
|
||||||
}
|
}
|
||||||
|
|
||||||
private XmlMappingBinderAccess createMappingBinderAccess(BootstrapServiceRegistry serviceRegistry) {
|
private XmlMappingBinderAccess createMappingBinderAccess(BootstrapServiceRegistry serviceRegistry) {
|
||||||
|
@ -197,10 +195,10 @@ public class Configuration {
|
||||||
* {@link BootstrapServiceRegistry} obtained from the {@link MetadataSources}.
|
* {@link BootstrapServiceRegistry} obtained from the {@link MetadataSources}.
|
||||||
*/
|
*/
|
||||||
public Configuration(MetadataSources metadataSources) {
|
public Configuration(MetadataSources metadataSources) {
|
||||||
this.bootstrapServiceRegistry = getBootstrapRegistry( metadataSources.getServiceRegistry() );
|
|
||||||
this.metadataSources = metadataSources;
|
this.metadataSources = metadataSources;
|
||||||
this.classmateContext = new ClassmateContext();
|
bootstrapServiceRegistry = getBootstrapRegistry( metadataSources.getServiceRegistry() );
|
||||||
reset();
|
standardServiceRegistryBuilder = new StandardServiceRegistryBuilder( bootstrapServiceRegistry );
|
||||||
|
properties.putAll( standardServiceRegistryBuilder.getSettings() );
|
||||||
}
|
}
|
||||||
|
|
||||||
private static BootstrapServiceRegistry getBootstrapRegistry(ServiceRegistry serviceRegistry) {
|
private static BootstrapServiceRegistry getBootstrapRegistry(ServiceRegistry serviceRegistry) {
|
||||||
|
@ -219,21 +217,6 @@ public class Configuration {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void reset() {
|
|
||||||
implicitNamingStrategy = ImplicitNamingStrategyJpaCompliantImpl.INSTANCE;
|
|
||||||
physicalNamingStrategy = PhysicalNamingStrategyStandardImpl.INSTANCE;
|
|
||||||
namedQueries = new HashMap<>();
|
|
||||||
namedSqlQueries = new HashMap<>();
|
|
||||||
sqlResultSetMappings = new HashMap<>();
|
|
||||||
namedEntityGraphMap = new HashMap<>();
|
|
||||||
namedProcedureCallMap = new HashMap<>();
|
|
||||||
|
|
||||||
standardServiceRegistryBuilder = new StandardServiceRegistryBuilder( bootstrapServiceRegistry );
|
|
||||||
interceptor = EmptyInterceptor.INSTANCE;
|
|
||||||
properties = new Properties( );
|
|
||||||
properties.putAll( standardServiceRegistryBuilder.getSettings() );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// properties/settings ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
// properties/settings ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue