HHH-6453 : Enable new metamodel in BaseCoreFunctionalTestCase
This commit is contained in:
parent
ba56266dec
commit
2b8f4bad7c
|
@ -53,7 +53,6 @@ import org.hibernate.mapping.Property;
|
||||||
import org.hibernate.mapping.SimpleValue;
|
import org.hibernate.mapping.SimpleValue;
|
||||||
import org.hibernate.metamodel.MetadataSources;
|
import org.hibernate.metamodel.MetadataSources;
|
||||||
import org.hibernate.metamodel.source.MetadataImplementor;
|
import org.hibernate.metamodel.source.MetadataImplementor;
|
||||||
import org.hibernate.metamodel.source.internal.MetadataImpl;
|
|
||||||
import org.hibernate.service.BasicServiceRegistry;
|
import org.hibernate.service.BasicServiceRegistry;
|
||||||
import org.hibernate.service.config.spi.ConfigurationService;
|
import org.hibernate.service.config.spi.ConfigurationService;
|
||||||
import org.hibernate.service.internal.BasicServiceRegistryImpl;
|
import org.hibernate.service.internal.BasicServiceRegistryImpl;
|
||||||
|
@ -118,7 +117,7 @@ public abstract class BaseCoreFunctionalTestCase extends BaseUnitTestCase {
|
||||||
@SuppressWarnings( {"UnusedDeclaration"})
|
@SuppressWarnings( {"UnusedDeclaration"})
|
||||||
private void buildSessionFactory() {
|
private void buildSessionFactory() {
|
||||||
// for now, build the configuration to get all the property settings
|
// for now, build the configuration to get all the property settings
|
||||||
configuration = buildConfiguration();
|
configuration = constructAndConfigureConfiguration();
|
||||||
serviceRegistry = buildServiceRegistry( configuration );
|
serviceRegistry = buildServiceRegistry( configuration );
|
||||||
isMetadataUsed = serviceRegistry.getService( ConfigurationService.class ).getSetting(
|
isMetadataUsed = serviceRegistry.getService( ConfigurationService.class ).getSetting(
|
||||||
AvailableSettings.USE_NEW_METADATA_MAPPINGS,
|
AvailableSettings.USE_NEW_METADATA_MAPPINGS,
|
||||||
|
@ -134,6 +133,8 @@ public abstract class BaseCoreFunctionalTestCase extends BaseUnitTestCase {
|
||||||
sessionFactory = ( SessionFactoryImplementor ) buildMetadata( serviceRegistry ).buildSessionFactory();
|
sessionFactory = ( SessionFactoryImplementor ) buildMetadata( serviceRegistry ).buildSessionFactory();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
// this is done here because Configuration does not currently support 4.0 xsd
|
||||||
|
afterConstructAndConfigureConfiguration( configuration );
|
||||||
sessionFactory = ( SessionFactoryImplementor ) configuration.buildSessionFactory( serviceRegistry );
|
sessionFactory = ( SessionFactoryImplementor ) configuration.buildSessionFactory( serviceRegistry );
|
||||||
}
|
}
|
||||||
afterSessionFactoryBuilt();
|
afterSessionFactoryBuilt();
|
||||||
|
@ -145,14 +146,24 @@ public abstract class BaseCoreFunctionalTestCase extends BaseUnitTestCase {
|
||||||
return (MetadataImplementor) sources.buildMetadata();
|
return (MetadataImplementor) sources.buildMetadata();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: is this still needed?
|
||||||
protected Configuration buildConfiguration() {
|
protected Configuration buildConfiguration() {
|
||||||
|
Configuration cfg = constructAndConfigureConfiguration();
|
||||||
|
afterConstructAndConfigureConfiguration( cfg );
|
||||||
|
return cfg;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Configuration constructAndConfigureConfiguration() {
|
||||||
Configuration cfg = constructConfiguration();
|
Configuration cfg = constructConfiguration();
|
||||||
configure( cfg );
|
configure( cfg );
|
||||||
|
return cfg;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void afterConstructAndConfigureConfiguration(Configuration cfg) {
|
||||||
addMappings( cfg );
|
addMappings( cfg );
|
||||||
cfg.buildMappings();
|
cfg.buildMappings();
|
||||||
applyCacheSettings( cfg );
|
applyCacheSettings( cfg );
|
||||||
afterConfigurationBuilt( cfg );
|
afterConfigurationBuilt( cfg );
|
||||||
return cfg;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Configuration constructConfiguration() {
|
protected Configuration constructConfiguration() {
|
||||||
|
|
Loading…
Reference in New Issue