HHH-12444 - Introduce BootstrapContext
HHH-12443 - Introduce TypeConfiguration
This commit is contained in:
parent
55e73c7202
commit
9229514ed4
|
@ -24,7 +24,6 @@ import javax.xml.transform.dom.DOMSource;
|
|||
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.boot.archive.spi.InputStreamAccess;
|
||||
import org.hibernate.boot.internal.ClassmateContext;
|
||||
import org.hibernate.boot.internal.MetadataBuilderImpl;
|
||||
import org.hibernate.boot.jaxb.Origin;
|
||||
import org.hibernate.boot.jaxb.SourceType;
|
||||
|
@ -61,10 +60,10 @@ public class MetadataSources implements Serializable {
|
|||
|
||||
private XmlMappingBinderAccess xmlMappingBinderAccess;
|
||||
|
||||
private List<Binding> xmlBindings = new ArrayList<Binding>();
|
||||
private LinkedHashSet<Class<?>> annotatedClasses = new LinkedHashSet<Class<?>>();
|
||||
private LinkedHashSet<String> annotatedClassNames = new LinkedHashSet<String>();
|
||||
private LinkedHashSet<String> annotatedPackages = new LinkedHashSet<String>();
|
||||
private List<Binding> xmlBindings = new ArrayList<>();
|
||||
private LinkedHashSet<Class<?>> annotatedClasses = new LinkedHashSet<>();
|
||||
private LinkedHashSet<String> annotatedClassNames = new LinkedHashSet<>();
|
||||
private LinkedHashSet<String> annotatedPackages = new LinkedHashSet<>();
|
||||
|
||||
public MetadataSources() {
|
||||
this( new BootstrapServiceRegistryBuilder().build() );
|
||||
|
@ -127,16 +126,6 @@ public class MetadataSources implements Serializable {
|
|||
return getCustomBuilderOrDefault( defaultBuilder );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a builder for metadata where non-default options can be specified.
|
||||
*
|
||||
* @return The built metadata.
|
||||
*/
|
||||
public MetadataBuilder getMetadataBuilder(StandardServiceRegistry serviceRegistry, ClassmateContext classmateContext) {
|
||||
MetadataBuilderImpl defaultBuilder = new MetadataBuilderImpl( this, serviceRegistry, classmateContext );
|
||||
return getCustomBuilderOrDefault( defaultBuilder );
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a builder for metadata where non-default options can be specified.
|
||||
*
|
||||
|
@ -145,7 +134,8 @@ public class MetadataSources implements Serializable {
|
|||
*/
|
||||
@Deprecated
|
||||
public MetadataBuilder getMetadataBuilder(StandardServiceRegistry serviceRegistry) {
|
||||
return getMetadataBuilder( serviceRegistry, new ClassmateContext() );
|
||||
MetadataBuilderImpl defaultBuilder = new MetadataBuilderImpl( this, serviceRegistry );
|
||||
return getCustomBuilderOrDefault( defaultBuilder );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -163,7 +153,7 @@ public class MetadataSources implements Serializable {
|
|||
final MetadataBuilder returnedBuilder = discoveredBuilderFactory.getMetadataBuilder( this, defaultBuilder );
|
||||
if ( returnedBuilder != null ) {
|
||||
if ( activeFactoryNames == null ) {
|
||||
activeFactoryNames = new ArrayList<String>();
|
||||
activeFactoryNames = new ArrayList<>();
|
||||
}
|
||||
activeFactoryNames.add( discoveredBuilderFactory.getClass().getName() );
|
||||
builder = returnedBuilder;
|
||||
|
|
|
@ -32,7 +32,6 @@ import org.hibernate.boot.registry.selector.spi.StrategySelector;
|
|||
import org.hibernate.boot.spi.BootstrapContext;
|
||||
import org.hibernate.boot.spi.ClassLoaderAccess;
|
||||
import org.hibernate.boot.spi.MetadataBuildingOptions;
|
||||
import org.hibernate.cfg.AttributeConverterDefinition;
|
||||
import org.hibernate.cfg.AvailableSettings;
|
||||
import org.hibernate.cfg.annotations.reflection.JPAMetadataProvider;
|
||||
import org.hibernate.dialect.function.SQLFunction;
|
||||
|
@ -73,10 +72,9 @@ public class BootstrapContextImpl implements BootstrapContext {
|
|||
|
||||
public BootstrapContextImpl(
|
||||
StandardServiceRegistry serviceRegistry,
|
||||
ClassmateContext classmateContext,
|
||||
MetadataBuildingOptions metadataBuildingOptions) {
|
||||
this.serviceRegistry = serviceRegistry;
|
||||
this.classmateContext = classmateContext;
|
||||
this.classmateContext = new ClassmateContext();
|
||||
this.metadataBuildingOptions = metadataBuildingOptions;
|
||||
|
||||
final ClassLoaderService classLoaderService = serviceRegistry.getService( ClassLoaderService.class );
|
||||
|
|
|
@ -377,6 +377,12 @@ public class InFlightMetadataCollectorImpl implements InFlightMetadataCollector
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ClassmateContext getClassmateContext() {
|
||||
return bootstrapContext.getClassmateContext();
|
||||
}
|
||||
|
||||
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// attribute converters
|
||||
|
||||
|
@ -2219,7 +2225,7 @@ public class InFlightMetadataCollectorImpl implements InFlightMetadataCollector
|
|||
*/
|
||||
public MetadataImpl buildMetadataInstance(MetadataBuildingContext buildingContext) {
|
||||
processSecondPasses( buildingContext );
|
||||
processExportableProducers( buildingContext );
|
||||
processExportableProducers( );
|
||||
|
||||
try {
|
||||
return new MetadataImpl(
|
||||
|
@ -2251,7 +2257,7 @@ public class InFlightMetadataCollectorImpl implements InFlightMetadataCollector
|
|||
}
|
||||
}
|
||||
|
||||
private void processExportableProducers(MetadataBuildingContext buildingContext) {
|
||||
private void processExportableProducers() {
|
||||
// for now we only handle id generators as ExportableProducers
|
||||
|
||||
final Dialect dialect = getDatabase().getJdbcEnvironment().getDialect();
|
||||
|
|
|
@ -9,6 +9,7 @@ package org.hibernate.boot.internal;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.Callable;
|
||||
import javax.persistence.AttributeConverter;
|
||||
import javax.persistence.SharedCacheMode;
|
||||
|
@ -16,6 +17,7 @@ import javax.persistence.SharedCacheMode;
|
|||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.MultiTenancyStrategy;
|
||||
import org.hibernate.annotations.CacheConcurrencyStrategy;
|
||||
import org.hibernate.annotations.common.reflection.ReflectionManager;
|
||||
import org.hibernate.boot.AttributeConverterInfo;
|
||||
import org.hibernate.boot.CacheRegionDefinition;
|
||||
import org.hibernate.boot.MetadataBuilder;
|
||||
|
@ -84,11 +86,7 @@ public class MetadataBuilderImpl implements MetadataBuilderImplementor, TypeCont
|
|||
private final MetadataBuildingOptionsImpl options;
|
||||
|
||||
public MetadataBuilderImpl(MetadataSources sources) {
|
||||
this(
|
||||
sources,
|
||||
getStandardServiceRegistry( sources.getServiceRegistry() ),
|
||||
new ClassmateContext()
|
||||
);
|
||||
this( sources, getStandardServiceRegistry( sources.getServiceRegistry() ) );
|
||||
}
|
||||
|
||||
private static StandardServiceRegistry getStandardServiceRegistry(ServiceRegistry serviceRegistry) {
|
||||
|
@ -116,10 +114,12 @@ public class MetadataBuilderImpl implements MetadataBuilderImplementor, TypeCont
|
|||
}
|
||||
}
|
||||
|
||||
public MetadataBuilderImpl(MetadataSources sources, StandardServiceRegistry serviceRegistry, ClassmateContext classmateContext) {
|
||||
public MetadataBuilderImpl(MetadataSources sources, StandardServiceRegistry serviceRegistry) {
|
||||
this.sources = sources;
|
||||
this.options = new MetadataBuildingOptionsImpl( serviceRegistry );
|
||||
this.bootstrapContext = new BootstrapContextImpl( serviceRegistry, classmateContext, options );
|
||||
this.bootstrapContext = new BootstrapContextImpl( serviceRegistry, options );
|
||||
//this is needed only fro implementig deprecated method
|
||||
options.setBootstrapContext( bootstrapContext );
|
||||
|
||||
for ( MetadataSourcesContributor contributor :
|
||||
sources.getServiceRegistry()
|
||||
|
@ -312,7 +312,6 @@ public class MetadataBuilderImpl implements MetadataBuilderImplementor, TypeCont
|
|||
return this;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public MetadataBuilder applySqlFunction(String functionName, SQLFunction function) {
|
||||
this.bootstrapContext.addSqlFunction( functionName, function );
|
||||
|
@ -436,11 +435,6 @@ public class MetadataBuilderImpl implements MetadataBuilderImplementor, TypeCont
|
|||
return this;
|
||||
}
|
||||
|
||||
// public MetadataBuilder with(PersistentAttributeMemberResolver resolver) {
|
||||
// options.persistentAttributeMemberResolver = resolver;
|
||||
// return this;
|
||||
// }
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T extends MetadataBuilder> T unwrap(Class<T> type) {
|
||||
|
@ -582,6 +576,8 @@ public class MetadataBuilderImpl implements MetadataBuilderImplementor, TypeCont
|
|||
implements MetadataBuildingOptions, JpaOrmXmlPersistenceUnitDefaultAware {
|
||||
private final StandardServiceRegistry serviceRegistry;
|
||||
private final MappingDefaultsImpl mappingDefaults;
|
||||
// todo (6.0) : remove bootstrapContext property along with the deprecated methods
|
||||
private BootstrapContext bootstrapContext;
|
||||
|
||||
private ArrayList<BasicTypeRegistration> basicTypeRegistrations = new ArrayList<>();
|
||||
|
||||
|
@ -602,9 +598,6 @@ public class MetadataBuilderImpl implements MetadataBuilderImplementor, TypeCont
|
|||
|
||||
private String schemaCharset;
|
||||
|
||||
// private PersistentAttributeMemberResolver persistentAttributeMemberResolver =
|
||||
// StandardPersistentAttributeMemberResolver.INSTANCE;
|
||||
|
||||
public MetadataBuildingOptionsImpl(StandardServiceRegistry serviceRegistry) {
|
||||
this.serviceRegistry = serviceRegistry;
|
||||
|
||||
|
@ -769,6 +762,41 @@ public class MetadataBuilderImpl implements MetadataBuilderImplementor, TypeCont
|
|||
return basicTypeRegistrations;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ReflectionManager getReflectionManager() {
|
||||
return bootstrapContext.getReflectionManager();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IndexView getJandexView() {
|
||||
return bootstrapContext.getJandexView();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ScanOptions getScanOptions() {
|
||||
return bootstrapContext.getScanOptions();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ScanEnvironment getScanEnvironment() {
|
||||
return bootstrapContext.getScanEnvironment();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getScanner() {
|
||||
return bootstrapContext.getScanner();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArchiveDescriptorFactory getArchiveDescriptorFactory() {
|
||||
return bootstrapContext.getArchiveDescriptorFactory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ClassLoader getTempClassLoader() {
|
||||
return bootstrapContext.getJpaTempClassLoader();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ImplicitNamingStrategy getImplicitNamingStrategy() {
|
||||
return implicitNamingStrategy;
|
||||
|
@ -799,6 +827,11 @@ public class MetadataBuilderImpl implements MetadataBuilderImplementor, TypeCont
|
|||
return idGenerationTypeInterpreter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CacheRegionDefinition> getCacheRegionDefinitions() {
|
||||
return new ArrayList<>( bootstrapContext.getCacheRegionDefinitions() );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean ignoreExplicitDiscriminatorsForJoinedInheritance() {
|
||||
return !explicitDiscriminatorsForJoinedInheritanceSupported;
|
||||
|
@ -829,6 +862,22 @@ public class MetadataBuilderImpl implements MetadataBuilderImplementor, TypeCont
|
|||
return sourceProcessOrdering;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, SQLFunction> getSqlFunctions() {
|
||||
return bootstrapContext.getSqlFunctions();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AuxiliaryDatabaseObject> getAuxiliaryDatabaseObjectList() {
|
||||
return new ArrayList<>( bootstrapContext.getAuxiliaryDatabaseObjectList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AttributeConverterInfo> getAttributeConverters() {
|
||||
return new ArrayList<>( bootstrapContext.getAttributeConverters() );
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSchemaCharset() {
|
||||
return schemaCharset;
|
||||
}
|
||||
|
@ -856,9 +905,8 @@ public class MetadataBuilderImpl implements MetadataBuilderImplementor, TypeCont
|
|||
}
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public PersistentAttributeMemberResolver getPersistentAttributeMemberResolver() {
|
||||
// return persistentAttributeMemberResolver;
|
||||
// }
|
||||
public void setBootstrapContext(BootstrapContextImpl bootstrapContext) {
|
||||
this.bootstrapContext = bootstrapContext;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ package org.hibernate.boot.internal;
|
|||
|
||||
import org.hibernate.boot.model.naming.ObjectNameNormalizer;
|
||||
import org.hibernate.boot.spi.BootstrapContext;
|
||||
import org.hibernate.boot.spi.ClassLoaderAccess;
|
||||
import org.hibernate.boot.spi.InFlightMetadataCollector;
|
||||
import org.hibernate.boot.spi.MappingDefaults;
|
||||
import org.hibernate.boot.spi.MetadataBuildingContext;
|
||||
|
@ -59,6 +60,11 @@ public class MetadataBuildingContextRootImpl implements MetadataBuildingContext
|
|||
return metadataCollector;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ClassLoaderAccess getClassLoaderAccess() {
|
||||
return bootstrapContext.getClassLoaderAccess();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ObjectNameNormalizer getObjectNameNormalizer() {
|
||||
return objectNameNormalizer;
|
||||
|
|
|
@ -430,6 +430,11 @@ public class SessionFactoryBuilderImpl implements SessionFactoryBuilderImplement
|
|||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void markAsJpaBootstrap() {
|
||||
this.bootstrapContext.markAsJpaBootstrap();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disableRefreshDetachedEntity() {
|
||||
this.optionsBuilder.disableRefreshDetachedEntity();
|
||||
|
|
|
@ -116,7 +116,7 @@ public class Helper {
|
|||
if ( xmlParamElements == null || xmlParamElements.isEmpty() ) {
|
||||
return Collections.emptyMap();
|
||||
}
|
||||
final HashMap<String,String> params = new HashMap<String, String>();
|
||||
final HashMap<String,String> params = new HashMap<>();
|
||||
for ( JaxbHbmConfigParameterType paramElement : xmlParamElements ) {
|
||||
params.put( paramElement.getName(), paramElement.getValue() );
|
||||
}
|
||||
|
@ -200,8 +200,8 @@ public class Helper {
|
|||
return createTableSource( mappingDocument, entityElement, inLineViewNameInferrer, null, null, null );
|
||||
}
|
||||
|
||||
public static interface InLineViewNameInferrer {
|
||||
public String inferInLineViewName();
|
||||
public interface InLineViewNameInferrer {
|
||||
String inferInLineViewName();
|
||||
}
|
||||
|
||||
public static TableSpecificationSource createTableSource(
|
||||
|
@ -270,20 +270,6 @@ public class Helper {
|
|||
MetadataBuildingContext buildingContext,
|
||||
Class attributeOwnerClass,
|
||||
final String attributeName) {
|
||||
// return BeanInfoHelper.visitBeanInfo(
|
||||
// attributeOwnerClass,
|
||||
// new BeanInfoHelper.ReturningBeanInfoDelegate<Class>() {
|
||||
// @Override
|
||||
// public Class processBeanInfo(BeanInfo beanInfo) throws Exception {
|
||||
// for ( PropertyDescriptor propertyDescriptor : beanInfo.getPropertyDescriptors() ) {
|
||||
// if ( propertyDescriptor.getName().equals( attributeName ) ) {
|
||||
// return propertyDescriptor.getPropertyType();
|
||||
// }
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
// }
|
||||
// );
|
||||
return ReflectHelper.reflectedPropertyClass( attributeOwnerClass, attributeName );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,6 +25,7 @@ import org.hibernate.boot.model.source.internal.OverriddenMappingDefaults;
|
|||
import org.hibernate.boot.model.source.spi.MetadataSourceProcessor;
|
||||
import org.hibernate.boot.model.source.spi.ToolingHintContext;
|
||||
import org.hibernate.boot.spi.BootstrapContext;
|
||||
import org.hibernate.boot.spi.ClassLoaderAccess;
|
||||
import org.hibernate.boot.spi.InFlightMetadataCollector;
|
||||
import org.hibernate.boot.spi.MappingDefaults;
|
||||
import org.hibernate.boot.spi.MetadataBuildingContext;
|
||||
|
@ -142,6 +143,11 @@ public class MappingDocument implements HbmLocalMetadataBuildingContext, Metadat
|
|||
return rootBuildingContext.getMetadataCollector();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ClassLoaderAccess getClassLoaderAccess() {
|
||||
return rootBuildingContext.getClassLoaderAccess();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ObjectNameNormalizer getObjectNameNormalizer() {
|
||||
return rootBuildingContext.getObjectNameNormalizer();
|
||||
|
|
|
@ -2837,20 +2837,6 @@ public class ModelBinder {
|
|||
typeParameters.putAll( typeDefinition.getParameters() );
|
||||
}
|
||||
}
|
||||
// else {
|
||||
// final BasicType basicType = sourceDocument.getMetadataCollector().getTypeResolver().basic( typeName );
|
||||
// if ( basicType == null ) {
|
||||
// throw new MappingException(
|
||||
// String.format(
|
||||
// Locale.ENGLISH,
|
||||
// "Mapping named an explicit type [%s] which could not be resolved",
|
||||
// typeName
|
||||
// ),
|
||||
// sourceDocument.getOrigin()
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
|
||||
// parameters on the property mapping should override parameters in the type-def
|
||||
if ( typeSource.getParameters() != null ) {
|
||||
typeParameters.putAll( typeSource.getParameters() );
|
||||
|
@ -3347,59 +3333,6 @@ public class ModelBinder {
|
|||
new RelationalObjectBinder.ColumnNamingDelegate() {
|
||||
@Override
|
||||
public Identifier determineImplicitName(final LocalMetadataBuildingContext context) {
|
||||
// another case where HbmBinder was not adjusted to make use of NamingStrategy#foreignKeyColumnName
|
||||
// when that was added in developing annotation binding :(
|
||||
// return implicitNamingStrategy.determineJoinColumnName(
|
||||
// new ImplicitJoinColumnNameSource() {
|
||||
// private EntityNamingSourceImpl entityNamingSource;
|
||||
// private Identifier referencedColumnName;
|
||||
//
|
||||
// @Override
|
||||
// public Nature getNature() {
|
||||
// return implicitNamingNature;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public EntityNaming getEntityNaming() {
|
||||
// if ( entityNamingSource == null ) {
|
||||
// entityNamingSource = new EntityNamingSourceImpl(
|
||||
// getCollectionBinding().getOwner().getEntityName(),
|
||||
// getCollectionBinding().getOwner().getClassName(),
|
||||
// getCollectionBinding().getOwner().getJpaEntityName()
|
||||
// );
|
||||
// }
|
||||
// return entityNamingSource;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public AttributePath getAttributePath() {
|
||||
// return getPluralAttributeSource().getAttributePath();
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public Identifier getReferencedTableName() {
|
||||
// return getCollectionBinding().getCollectionTable().getNameIdentifier();
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public Identifier getReferencedColumnName() {
|
||||
// if ( referencedColumnName == null ) {
|
||||
// final Iterator<Selectable> selectableItr = keyVal.getColumnIterator();
|
||||
// // assume there is just one, and that its a column...
|
||||
// final Column column = (Column) selectableItr.next();
|
||||
// referencedColumnName = getMappingDocument().getMetadataCollector()
|
||||
// .getDatabase()
|
||||
// .toIdentifier( column.getQuotedName() );
|
||||
// }
|
||||
// return referencedColumnName;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public MetadataBuildingContext getBuildingContext() {
|
||||
// return context;
|
||||
// }
|
||||
// }
|
||||
// );
|
||||
return context.getMetadataCollector().getDatabase().toIdentifier( Collection.DEFAULT_KEY_COLUMN_NAME );
|
||||
}
|
||||
}
|
||||
|
@ -3477,9 +3410,6 @@ public class ModelBinder {
|
|||
new RelationalObjectBinder.ColumnNamingDelegate() {
|
||||
@Override
|
||||
public Identifier determineImplicitName(LocalMetadataBuildingContext context) {
|
||||
// return implicitNamingStrategy.determineBasicColumnName(
|
||||
// elementSource
|
||||
// );
|
||||
return context.getMetadataCollector().getDatabase().toIdentifier( Collection.DEFAULT_ELEMENT_COLUMN_NAME );
|
||||
}
|
||||
}
|
||||
|
@ -3540,82 +3470,6 @@ public class ModelBinder {
|
|||
new RelationalObjectBinder.ColumnNamingDelegate() {
|
||||
@Override
|
||||
public Identifier determineImplicitName(final LocalMetadataBuildingContext context) {
|
||||
// return implicitNamingStrategy.determineJoinColumnName(
|
||||
// new ImplicitJoinColumnNameSource() {
|
||||
// private final PersistentClass pc = mappingDocument.getMetadataCollector()
|
||||
// .getEntityBinding( elementSource.getReferencedEntityName() );
|
||||
// private final EntityNaming referencedEntityNaming = new EntityNamingSourceImpl(
|
||||
// pc
|
||||
// );
|
||||
// private Identifier referencedTableName;
|
||||
// private Identifier referencedColumnName;
|
||||
//
|
||||
// @Override
|
||||
// public Nature getNature() {
|
||||
// return Nature.ENTITY_COLLECTION;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public EntityNaming getEntityNaming() {
|
||||
// return referencedEntityNaming;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public AttributePath getAttributePath() {
|
||||
// // this is the mapped-by attribute, which we do not
|
||||
// // know here
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public Identifier getReferencedTableName() {
|
||||
// if ( referencedTableName == null ) {
|
||||
// resolveTableAndColumn();
|
||||
// }
|
||||
// return referencedTableName;
|
||||
// }
|
||||
//
|
||||
// private void resolveTableAndColumn() {
|
||||
// final Iterator itr;
|
||||
//
|
||||
// if ( elementSource.getReferencedEntityAttributeName() == null ) {
|
||||
// // refers to PK
|
||||
// referencedTableName = pc.getIdentifier()
|
||||
// .getTable()
|
||||
// .getNameIdentifier();
|
||||
// itr = pc.getIdentifier().getColumnIterator();
|
||||
// }
|
||||
// else {
|
||||
// // refers to an attribute's column(s)
|
||||
// final Property referencedAttribute = pc.getProperty( elementSource.getReferencedEntityAttributeName() );
|
||||
// referencedTableName = referencedAttribute.getValue()
|
||||
// .getTable()
|
||||
// .getNameIdentifier();
|
||||
// itr = referencedAttribute.getValue().getColumnIterator();
|
||||
// }
|
||||
//
|
||||
// // assume one and only one...
|
||||
// referencedColumnName = context.getMetadataCollector()
|
||||
// .getDatabase()
|
||||
// .getJdbcEnvironment()
|
||||
// .getIdentifierHelper()
|
||||
// .toIdentifier( ( (Column) itr.next() ).getQuotedName() );
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public Identifier getReferencedColumnName() {
|
||||
// if ( referencedColumnName == null ) {
|
||||
// resolveTableAndColumn();
|
||||
// }
|
||||
// return referencedColumnName;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public MetadataBuildingContext getBuildingContext() {
|
||||
// return context;
|
||||
// }
|
||||
// }
|
||||
// );
|
||||
return context.getMetadataCollector().getDatabase().toIdentifier( Collection.DEFAULT_ELEMENT_COLUMN_NAME );
|
||||
}
|
||||
}
|
||||
|
@ -4169,8 +4023,6 @@ public class ModelBinder {
|
|||
// implicit naming. If we get here, we assume that there is only a single
|
||||
// column making up the FK
|
||||
|
||||
// final String referencedEntityAttributeName = manyToOneSource.getReferencedEntityAttributeName();
|
||||
|
||||
final PersistentClass referencedEntityBinding = mappingDocument.getMetadataCollector()
|
||||
.getEntityBinding( referencedEntityName );
|
||||
|
||||
|
@ -4181,36 +4033,6 @@ public class ModelBinder {
|
|||
);
|
||||
}
|
||||
|
||||
// final EntityNaming entityNaming = new EntityNamingSourceImpl( referencedEntityBinding );
|
||||
//
|
||||
// final Identifier referencedTableName;
|
||||
// final Identifier referencedColumnName;
|
||||
//
|
||||
// if ( referencedEntityAttributeName == null ) {
|
||||
// referencedTableName = referencedEntityBinding.getTable().getNameIdentifier();
|
||||
// final Column referencedColumn = referencedEntityBinding.getTable()
|
||||
// .getPrimaryKey()
|
||||
// .getColumn( 0 );
|
||||
// referencedColumnName = mappingDocument.getMetadataCollector()
|
||||
// .getDatabase()
|
||||
// .getJdbcEnvironment()
|
||||
// .getIdentifierHelper()
|
||||
// .toIdentifier( referencedColumn.getQuotedName() );
|
||||
// }
|
||||
// else {
|
||||
// final Property referencedProperty = referencedEntityBinding.getReferencedProperty(
|
||||
// referencedEntityAttributeName
|
||||
// );
|
||||
// final SimpleValue value = (SimpleValue) referencedProperty.getValue();
|
||||
// referencedTableName = value.getTable().getNameIdentifier();
|
||||
// final Column referencedColumn = (Column) value.getColumnIterator().next();
|
||||
// referencedColumnName = mappingDocument.getMetadataCollector()
|
||||
// .getDatabase()
|
||||
// .getJdbcEnvironment()
|
||||
// .getIdentifierHelper()
|
||||
// .toIdentifier( referencedColumn.getQuotedName() );
|
||||
// }
|
||||
|
||||
relationalObjectBinder.bindColumnsAndFormulas(
|
||||
mappingDocument,
|
||||
manyToOneSource.getRelationalValueSources(),
|
||||
|
@ -4219,45 +4041,6 @@ public class ModelBinder {
|
|||
new RelationalObjectBinder.ColumnNamingDelegate() {
|
||||
@Override
|
||||
public Identifier determineImplicitName(final LocalMetadataBuildingContext context) {
|
||||
// NOTE : This sucks!!! The problem is that the legacy HBMBinder routed this
|
||||
// through the legacy NamingStrategy#propertyToColumName.
|
||||
//
|
||||
// Basically, when developing the AnnotationBinder and
|
||||
// NamingStrategy#foreignKeyColumnName HbmBinder was never updated to
|
||||
// utilize that new method.
|
||||
// return implicitNamingStrategy.determineJoinColumnName(
|
||||
// new ImplicitJoinColumnNameSource() {
|
||||
// @Override
|
||||
// public Nature getNature() {
|
||||
// return Nature.ENTITY;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public EntityNaming getEntityNaming() {
|
||||
// return entityNaming;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public AttributePath getAttributePath() {
|
||||
// return manyToOneSource.getAttributePath();
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public Identifier getReferencedTableName() {
|
||||
// return referencedTableName;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public Identifier getReferencedColumnName() {
|
||||
// return referencedColumnName;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public MetadataBuildingContext getBuildingContext() {
|
||||
// return context;
|
||||
// }
|
||||
// }
|
||||
// );
|
||||
return implicitNamingStrategy.determineBasicColumnName(
|
||||
new ImplicitBasicColumnNameSource() {
|
||||
@Override
|
||||
|
|
|
@ -12,7 +12,12 @@ import javax.persistence.SharedCacheMode;
|
|||
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.MultiTenancyStrategy;
|
||||
import org.hibernate.annotations.common.reflection.ReflectionManager;
|
||||
import org.hibernate.boot.AttributeConverterInfo;
|
||||
import org.hibernate.boot.CacheRegionDefinition;
|
||||
import org.hibernate.boot.archive.scan.spi.ScanEnvironment;
|
||||
import org.hibernate.boot.archive.scan.spi.ScanOptions;
|
||||
import org.hibernate.boot.archive.spi.ArchiveDescriptorFactory;
|
||||
import org.hibernate.boot.model.IdGeneratorStrategyInterpreter;
|
||||
import org.hibernate.boot.model.naming.ImplicitNamingStrategy;
|
||||
import org.hibernate.boot.model.naming.PhysicalNamingStrategy;
|
||||
|
@ -58,6 +63,36 @@ public abstract class AbstractDelegatingMetadataBuildingOptions implements Metad
|
|||
return delegate.getBasicTypeRegistrations();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IndexView getJandexView() {
|
||||
return delegate.getJandexView();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ScanOptions getScanOptions() {
|
||||
return delegate.getScanOptions();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ScanEnvironment getScanEnvironment() {
|
||||
return delegate.getScanEnvironment();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getScanner() {
|
||||
return delegate.getScanner();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArchiveDescriptorFactory getArchiveDescriptorFactory() {
|
||||
return delegate.getArchiveDescriptorFactory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ClassLoader getTempClassLoader() {
|
||||
return delegate.getTempClassLoader();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ImplicitNamingStrategy getImplicitNamingStrategy() {
|
||||
return delegate.getImplicitNamingStrategy();
|
||||
|
@ -68,6 +103,11 @@ public abstract class AbstractDelegatingMetadataBuildingOptions implements Metad
|
|||
return delegate.getPhysicalNamingStrategy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ReflectionManager getReflectionManager() {
|
||||
return delegate.getReflectionManager();
|
||||
}
|
||||
|
||||
@Override
|
||||
public SharedCacheMode getSharedCacheMode() {
|
||||
return delegate.getSharedCacheMode();
|
||||
|
@ -88,6 +128,11 @@ public abstract class AbstractDelegatingMetadataBuildingOptions implements Metad
|
|||
return delegate.getIdGenerationTypeInterpreter();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CacheRegionDefinition> getCacheRegionDefinitions() {
|
||||
return delegate.getCacheRegionDefinitions();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean ignoreExplicitDiscriminatorsForJoinedInheritance() {
|
||||
return delegate.ignoreExplicitDiscriminatorsForJoinedInheritance();
|
||||
|
@ -118,6 +163,21 @@ public abstract class AbstractDelegatingMetadataBuildingOptions implements Metad
|
|||
return delegate.getSourceProcessOrdering();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, SQLFunction> getSqlFunctions() {
|
||||
return delegate.getSqlFunctions();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AuxiliaryDatabaseObject> getAuxiliaryDatabaseObjectList() {
|
||||
return delegate.getAuxiliaryDatabaseObjectList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AttributeConverterInfo> getAttributeConverters() {
|
||||
return delegate.getAttributeConverters();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void apply(JpaOrmXmlPersistenceUnitDefaults jpaOrmXmlPersistenceUnitDefaults) {
|
||||
if ( delegate instanceof JpaOrmXmlPersistenceUnitDefaultAware ) {
|
||||
|
|
|
@ -27,6 +27,11 @@ public abstract class AbstractDelegatingSessionFactoryBuilderImplementor<T exten
|
|||
|
||||
@SuppressWarnings("deprecation")
|
||||
|
||||
@Override
|
||||
public void markAsJpaBootstrap() {
|
||||
delegate().markAsJpaBootstrap();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disableJtaTransactionAccess() {
|
||||
delegate().disableJtaTransactionAccess();
|
||||
|
|
|
@ -22,7 +22,7 @@ import org.jboss.jandex.IndexView;
|
|||
@Deprecated
|
||||
public interface AdditionalJaxbMappingProducer {
|
||||
Collection<MappingDocument> produceAdditionalMappings(
|
||||
InFlightMetadataCollector metadata,
|
||||
MetadataImplementor metadata,
|
||||
IndexView jandexIndex,
|
||||
MappingBinder mappingBinder,
|
||||
MetadataBuildingContext buildingContext);
|
||||
|
|
|
@ -141,7 +141,7 @@ public interface BootstrapContext {
|
|||
* <p/>
|
||||
* Should never return {@code null}
|
||||
*
|
||||
* @return
|
||||
* @return The AttributeConverterInfo registered through MetadataBuilder
|
||||
*/
|
||||
Collection<AttributeConverterInfo> getAttributeConverters();
|
||||
|
||||
|
|
|
@ -303,6 +303,17 @@ public interface InFlightMetadataCollector extends Mapping, MetadataImplementor
|
|||
NaturalIdUniqueKeyBinder locateNaturalIdUniqueKeyBinder(String entityName);
|
||||
void registerNaturalIdUniqueKeyBinder(String entityName, NaturalIdUniqueKeyBinder ukBinder);
|
||||
|
||||
/**
|
||||
* Access to the shared Classmate objects used throughout Hibernate's
|
||||
* bootstrap process.
|
||||
*
|
||||
* @return Access to the shared Classmate delegates.
|
||||
*
|
||||
* @deprecated Use {@link BootstrapContext#getClassmateContext()} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
ClassmateContext getClassmateContext();
|
||||
|
||||
interface DelayedPropertyReferenceHandler extends Serializable {
|
||||
void process(InFlightMetadataCollector metadataCollector);
|
||||
}
|
||||
|
|
|
@ -41,6 +41,15 @@ public interface MetadataBuildingContext {
|
|||
*/
|
||||
InFlightMetadataCollector getMetadataCollector();
|
||||
|
||||
/**
|
||||
* Provides access to ClassLoader services when needed during binding
|
||||
*
|
||||
* @return The ClassLoaderAccess
|
||||
*
|
||||
* @deprecated Use {@link BootstrapContext#getClassLoaderAccess()}} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
ClassLoaderAccess getClassLoaderAccess();
|
||||
|
||||
/**
|
||||
* Not sure how I feel about this exposed here
|
||||
|
|
|
@ -7,15 +7,26 @@
|
|||
package org.hibernate.boot.spi;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import javax.persistence.SharedCacheMode;
|
||||
|
||||
import org.hibernate.MultiTenancyStrategy;
|
||||
import org.hibernate.annotations.common.reflection.ReflectionManager;
|
||||
import org.hibernate.boot.AttributeConverterInfo;
|
||||
import org.hibernate.boot.CacheRegionDefinition;
|
||||
import org.hibernate.boot.archive.scan.spi.ScanEnvironment;
|
||||
import org.hibernate.boot.archive.scan.spi.ScanOptions;
|
||||
import org.hibernate.boot.archive.spi.ArchiveDescriptorFactory;
|
||||
import org.hibernate.boot.model.IdGeneratorStrategyInterpreter;
|
||||
import org.hibernate.boot.model.naming.ImplicitNamingStrategy;
|
||||
import org.hibernate.boot.model.naming.PhysicalNamingStrategy;
|
||||
import org.hibernate.boot.model.relational.AuxiliaryDatabaseObject;
|
||||
import org.hibernate.boot.registry.StandardServiceRegistry;
|
||||
import org.hibernate.cache.spi.access.AccessType;
|
||||
import org.hibernate.cfg.MetadataSourceType;
|
||||
import org.hibernate.dialect.function.SQLFunction;
|
||||
|
||||
import org.jboss.jandex.IndexView;
|
||||
|
||||
/**
|
||||
* Describes the options used while building the Metadata object (during
|
||||
|
@ -53,6 +64,87 @@ public interface MetadataBuildingOptions {
|
|||
*/
|
||||
List<BasicTypeRegistration> getBasicTypeRegistrations();
|
||||
|
||||
/**
|
||||
* Retrieve the Hibernate Commons Annotations ReflectionManager to use.
|
||||
*
|
||||
* @return The Hibernate Commons Annotations ReflectionManager to use.
|
||||
*
|
||||
* @deprecated Use {@link BootstrapContext#getReflectionManager()} instead,
|
||||
* The plan is to remove first {@link MetadataBuildingOptions#getReflectionManager()}
|
||||
* keeping {@link BootstrapContext#getReflectionManager()} till the migration from
|
||||
* Hibernate Commons Annotations to Jandex.
|
||||
*
|
||||
*/
|
||||
@Deprecated
|
||||
ReflectionManager getReflectionManager();
|
||||
|
||||
/**
|
||||
* Access to the Jandex index passed by call to
|
||||
* {@link org.hibernate.boot.MetadataBuilder#applyIndexView(org.jboss.jandex.IndexView)}, if any.
|
||||
*
|
||||
* @return The Jandex index
|
||||
*
|
||||
* @deprecated Use {@link BootstrapContext#getJandexView()} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
IndexView getJandexView();
|
||||
|
||||
/**
|
||||
* Access to the options to be used for scanning
|
||||
*
|
||||
* @return The scan options
|
||||
*
|
||||
* @deprecated Use {@link BootstrapContext#getScanOptions()} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
ScanOptions getScanOptions();
|
||||
|
||||
/**
|
||||
* Access to the environment for scanning. Consider this temporary; see discussion on
|
||||
* {@link ScanEnvironment}
|
||||
*
|
||||
* @return The scan environment
|
||||
*
|
||||
* @deprecated Use {@link BootstrapContext#getScanEnvironment()} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
ScanEnvironment getScanEnvironment();
|
||||
|
||||
/**
|
||||
* Access to the Scanner to be used for scanning. Can be:<ul>
|
||||
* <li>A Scanner instance</li>
|
||||
* <li>A Class reference to the Scanner implementor</li>
|
||||
* <li>A String naming the Scanner implementor</li>
|
||||
* </ul>
|
||||
*
|
||||
* @return The scanner
|
||||
*
|
||||
* @deprecated Use {@link BootstrapContext#getScanner()} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
Object getScanner();
|
||||
|
||||
/**
|
||||
* Access to the ArchiveDescriptorFactory to be used for scanning
|
||||
*
|
||||
* @return The ArchiveDescriptorFactory
|
||||
*
|
||||
* @deprecated Use {@link BootstrapContext#getArchiveDescriptorFactory()} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
ArchiveDescriptorFactory getArchiveDescriptorFactory();
|
||||
|
||||
/**
|
||||
* Access the temporary ClassLoader passed to us as defined by
|
||||
* {@link javax.persistence.spi.PersistenceUnitInfo#getNewTempClassLoader()}, if any.
|
||||
*
|
||||
* @return The tempo ClassLoader
|
||||
*
|
||||
* @deprecated Use {@link BootstrapContext#getJpaTempClassLoader()} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
ClassLoader getTempClassLoader();
|
||||
|
||||
ImplicitNamingStrategy getImplicitNamingStrategy();
|
||||
|
||||
PhysicalNamingStrategy getPhysicalNamingStrategy();
|
||||
|
@ -81,6 +173,16 @@ public interface MetadataBuildingOptions {
|
|||
|
||||
IdGeneratorStrategyInterpreter getIdGenerationTypeInterpreter();
|
||||
|
||||
/**
|
||||
* Access to all explicit cache region mappings.
|
||||
*
|
||||
* @return Explicit cache region mappings.
|
||||
*
|
||||
* @deprecated Use {@link BootstrapContext#getClassmateContext()} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
List<CacheRegionDefinition> getCacheRegionDefinitions();
|
||||
|
||||
/**
|
||||
* Whether explicit discriminator declarations should be ignored for joined
|
||||
* subclass style inheritance.
|
||||
|
@ -135,14 +237,39 @@ public interface MetadataBuildingOptions {
|
|||
*/
|
||||
List<MetadataSourceType> getSourceProcessOrdering();
|
||||
|
||||
default String getSchemaCharset() {
|
||||
default String getSchemaCharset() {
|
||||
return null;
|
||||
}
|
||||
}/**
|
||||
* Access to any SQL functions explicitly registered with the MetadataBuilder. This
|
||||
* does not include Dialect defined functions, etc.
|
||||
*
|
||||
* @return The SQLFunctions registered through MetadataBuilder
|
||||
*
|
||||
* @deprecated Use {@link BootstrapContext#getSqlFunctions()} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
Map<String,SQLFunction> getSqlFunctions();
|
||||
|
||||
// /**
|
||||
// * Obtain the selected strategy for resolving members identifying persistent attributes
|
||||
// *
|
||||
// * @return The select resolver strategy
|
||||
// */
|
||||
// PersistentAttributeMemberResolver getPersistentAttributeMemberResolver();
|
||||
/**
|
||||
* Access to any AuxiliaryDatabaseObject explicitly registered with the MetadataBuilder. This
|
||||
* does not include AuxiliaryDatabaseObject defined in mappings.
|
||||
*
|
||||
* @return The AuxiliaryDatabaseObject registered through MetadataBuilder
|
||||
*
|
||||
* @deprecated Use {@link BootstrapContext#getAuxiliaryDatabaseObjectList()} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
List<AuxiliaryDatabaseObject> getAuxiliaryDatabaseObjectList();
|
||||
|
||||
/**
|
||||
* /**
|
||||
* * Access to collected AttributeConverter definitions.
|
||||
* * <p/>
|
||||
*
|
||||
* @return The AttributeConverterInfo registered through MetadataBuilder
|
||||
*
|
||||
* @deprecated Use {@link BootstrapContext#getAttributeConverters()} instead
|
||||
*/
|
||||
@Deprecated
|
||||
List<AttributeConverterInfo> getAttributeConverters();
|
||||
}
|
||||
|
|
|
@ -15,6 +15,21 @@ import org.hibernate.boot.SessionFactoryBuilder;
|
|||
* @author Steve Ebersole
|
||||
*/
|
||||
public interface SessionFactoryBuilderImplementor extends SessionFactoryBuilder {
|
||||
/**
|
||||
* Indicates that the SessionFactory being built comes from JPA bootstrapping.
|
||||
* Internally {@code false} is the assumed value. We only need to call this to
|
||||
* mark that as true.
|
||||
*
|
||||
* @deprecated (since 5.2) In fact added in 5.2 as part of consolidating JPA support
|
||||
* directly into Hibernate contracts (SessionFactory, Session); intended to provide
|
||||
* transition help in cases where we need to know the difference in JPA/native use for
|
||||
* various reasons.
|
||||
* Use {@link BootstrapContext#markAsJpaBootstrap()}
|
||||
*
|
||||
*/
|
||||
@Deprecated
|
||||
void markAsJpaBootstrap();
|
||||
|
||||
void disableJtaTransactionAccess();
|
||||
|
||||
default void disableRefreshDetachedEntity() {
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||
*/
|
||||
package org.hibernate.cfg;
|
||||
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.OneToOne;
|
||||
|
||||
|
|
|
@ -22,8 +22,13 @@ import javax.persistence.TableGenerator;
|
|||
import org.hibernate.annotations.common.reflection.AnnotationReader;
|
||||
import org.hibernate.annotations.common.reflection.MetadataProvider;
|
||||
import org.hibernate.annotations.common.reflection.java.JavaMetadataProvider;
|
||||
import org.hibernate.boot.internal.ClassLoaderAccessImpl;
|
||||
import org.hibernate.boot.registry.classloading.spi.ClassLoaderService;
|
||||
import org.hibernate.boot.registry.classloading.spi.ClassLoadingException;
|
||||
import org.hibernate.boot.spi.BootstrapContext;
|
||||
import org.hibernate.boot.spi.ClassLoaderAccess;
|
||||
import org.hibernate.boot.spi.ClassLoaderAccessDelegateImpl;
|
||||
import org.hibernate.boot.spi.MetadataBuildingOptions;
|
||||
|
||||
import org.dom4j.Element;
|
||||
|
||||
|
@ -36,18 +41,42 @@ import org.dom4j.Element;
|
|||
public class JPAMetadataProvider implements MetadataProvider {
|
||||
private final MetadataProvider delegate = new JavaMetadataProvider();
|
||||
|
||||
private final BootstrapContext bootstrapContext;
|
||||
private final ClassLoaderAccess classLoaderAccess;
|
||||
private final XMLContext xmlContext;
|
||||
|
||||
|
||||
private Map<Object, Object> defaults;
|
||||
private Map<AnnotatedElement, AnnotationReader> cache = new HashMap<AnnotatedElement, AnnotationReader>(100);
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link JPAMetadataProvider#JPAMetadataProvider(BootstrapContext)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public JPAMetadataProvider(final MetadataBuildingOptions metadataBuildingOptions) {
|
||||
this( new ClassLoaderAccessDelegateImpl() {
|
||||
ClassLoaderAccess delegate;
|
||||
|
||||
@Override
|
||||
protected ClassLoaderAccess getDelegate() {
|
||||
if ( delegate == null ) {
|
||||
delegate = new ClassLoaderAccessImpl(
|
||||
metadataBuildingOptions.getTempClassLoader(),
|
||||
metadataBuildingOptions.getServiceRegistry().getService( ClassLoaderService.class )
|
||||
);
|
||||
}
|
||||
return delegate;
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
public JPAMetadataProvider(BootstrapContext bootstrapContext) {
|
||||
this.bootstrapContext = bootstrapContext;
|
||||
|
||||
xmlContext = new XMLContext( bootstrapContext );
|
||||
this( bootstrapContext.getClassLoaderAccess() );
|
||||
}
|
||||
|
||||
JPAMetadataProvider(ClassLoaderAccess classLoaderAccess) {
|
||||
this.classLoaderAccess = classLoaderAccess;
|
||||
this.xmlContext = new XMLContext( classLoaderAccess );
|
||||
;
|
||||
}
|
||||
|
||||
//all of the above can be safely rebuilt from XMLContext: only XMLContext this object is serialized
|
||||
|
@ -56,7 +85,7 @@ public class JPAMetadataProvider implements MetadataProvider {
|
|||
AnnotationReader reader = cache.get( annotatedElement );
|
||||
if (reader == null) {
|
||||
if ( xmlContext.hasContext() ) {
|
||||
reader = new JPAOverriddenAnnotationReader( annotatedElement, xmlContext, bootstrapContext );
|
||||
reader = new JPAOverriddenAnnotationReader( annotatedElement, xmlContext, classLoaderAccess );
|
||||
}
|
||||
else {
|
||||
reader = delegate.getAnnotationReader( annotatedElement );
|
||||
|
@ -78,7 +107,7 @@ public class JPAMetadataProvider implements MetadataProvider {
|
|||
List<Class> entityListeners = new ArrayList<Class>();
|
||||
for ( String className : xmlContext.getDefaultEntityListeners() ) {
|
||||
try {
|
||||
entityListeners.add( bootstrapContext.getClassLoaderAccess().classForName( className ) );
|
||||
entityListeners.add( classLoaderAccess.classForName( className ) );
|
||||
}
|
||||
catch ( ClassLoadingException e ) {
|
||||
throw new IllegalStateException( "Default entity listener class not found: " + className );
|
||||
|
@ -120,7 +149,7 @@ public class JPAMetadataProvider implements MetadataProvider {
|
|||
element,
|
||||
false,
|
||||
xmlDefaults,
|
||||
bootstrapContext.getClassLoaderAccess()
|
||||
classLoaderAccess
|
||||
);
|
||||
namedQueries.addAll( currentNamedQueries );
|
||||
|
||||
|
@ -133,7 +162,7 @@ public class JPAMetadataProvider implements MetadataProvider {
|
|||
element,
|
||||
true,
|
||||
xmlDefaults,
|
||||
bootstrapContext.getClassLoaderAccess()
|
||||
classLoaderAccess
|
||||
);
|
||||
namedNativeQueries.addAll( currentNamedNativeQueries );
|
||||
|
||||
|
@ -147,7 +176,7 @@ public class JPAMetadataProvider implements MetadataProvider {
|
|||
List<SqlResultSetMapping> currentSqlResultSetMappings = JPAOverriddenAnnotationReader.buildSqlResultsetMappings(
|
||||
element,
|
||||
xmlDefaults,
|
||||
bootstrapContext.getClassLoaderAccess()
|
||||
classLoaderAccess
|
||||
);
|
||||
sqlResultSetMappings.addAll( currentSqlResultSetMappings );
|
||||
|
||||
|
@ -159,7 +188,7 @@ public class JPAMetadataProvider implements MetadataProvider {
|
|||
List<NamedStoredProcedureQuery> currentNamedStoredProcedureQueries = JPAOverriddenAnnotationReader.buildNamedStoreProcedureQueries(
|
||||
element,
|
||||
xmlDefaults,
|
||||
bootstrapContext.getClassLoaderAccess()
|
||||
classLoaderAccess
|
||||
);
|
||||
namedStoredProcedureQueries.addAll( currentNamedStoredProcedureQueries );
|
||||
}
|
||||
|
|
|
@ -239,7 +239,7 @@ public class JPAOverriddenAnnotationReader implements AnnotationReader {
|
|||
}
|
||||
|
||||
private XMLContext xmlContext;
|
||||
private final BootstrapContext bootstrapContext;
|
||||
private final ClassLoaderAccess classLoaderAccess;
|
||||
private final AnnotatedElement element;
|
||||
private String className;
|
||||
private String propertyName;
|
||||
|
@ -249,10 +249,16 @@ public class JPAOverriddenAnnotationReader implements AnnotationReader {
|
|||
private transient List<Element> elementsForProperty;
|
||||
private AccessibleObject mirroredAttribute;
|
||||
|
||||
public JPAOverriddenAnnotationReader(AnnotatedElement el, XMLContext xmlContext, BootstrapContext bootstrapContext) {
|
||||
/**
|
||||
* @deprecated Use {@link JPAMetadataProvider(AnnotatedElement, XMLContext, BootstrapContext)} instead.
|
||||
*/
|
||||
public JPAOverriddenAnnotationReader(
|
||||
AnnotatedElement el,
|
||||
XMLContext xmlContext,
|
||||
ClassLoaderAccess classLoaderAccess) {
|
||||
this.element = el;
|
||||
this.xmlContext = xmlContext;
|
||||
this.bootstrapContext = bootstrapContext;
|
||||
this.classLoaderAccess = classLoaderAccess;
|
||||
|
||||
if ( el instanceof Class ) {
|
||||
Class clazz = (Class) el;
|
||||
|
@ -307,6 +313,14 @@ public class JPAOverriddenAnnotationReader implements AnnotationReader {
|
|||
}
|
||||
}
|
||||
|
||||
public JPAOverriddenAnnotationReader(
|
||||
AnnotatedElement el,
|
||||
XMLContext xmlContext,
|
||||
BootstrapContext bootstrapContext) {
|
||||
this( el, xmlContext, bootstrapContext.getClassLoaderAccess() );
|
||||
}
|
||||
|
||||
|
||||
public <T extends Annotation> T getAnnotation(Class<T> annotationType) {
|
||||
initAnnotations();
|
||||
return (T) annotationsMap.get( annotationType );
|
||||
|
@ -510,7 +524,7 @@ public class JPAOverriddenAnnotationReader implements AnnotationReader {
|
|||
defaults
|
||||
);
|
||||
try {
|
||||
final Class converterClass = bootstrapContext.getClassLoaderAccess().classForName( converterClassName );
|
||||
final Class converterClass = classLoaderAccess.classForName( converterClassName );
|
||||
convertAnnotationDescriptor.setValue( "converter", converterClass );
|
||||
}
|
||||
catch (ClassLoadingException e) {
|
||||
|
@ -569,7 +583,7 @@ public class JPAOverriddenAnnotationReader implements AnnotationReader {
|
|||
private void checkForOrphanProperties(Element tree) {
|
||||
Class clazz;
|
||||
try {
|
||||
clazz = bootstrapContext.getClassLoaderAccess().classForName( className );
|
||||
clazz = classLoaderAccess.classForName( className );
|
||||
}
|
||||
catch ( ClassLoadingException e ) {
|
||||
return; //a primitive type most likely
|
||||
|
@ -713,7 +727,7 @@ public class JPAOverriddenAnnotationReader implements AnnotationReader {
|
|||
String className = subelement.attributeValue( "class" );
|
||||
try {
|
||||
entityListenerClasses.add(
|
||||
bootstrapContext.getClassLoaderAccess().classForName(
|
||||
classLoaderAccess.classForName(
|
||||
XMLContext.buildSafeClassName( className, defaults )
|
||||
)
|
||||
);
|
||||
|
@ -1128,7 +1142,7 @@ public class JPAOverriddenAnnotationReader implements AnnotationReader {
|
|||
if ( className != null ) {
|
||||
Class clazz;
|
||||
try {
|
||||
clazz = bootstrapContext.getClassLoaderAccess().classForName( XMLContext.buildSafeClassName( className, defaults ) );
|
||||
clazz = classLoaderAccess.classForName( XMLContext.buildSafeClassName( className, defaults ) );
|
||||
}
|
||||
catch ( ClassLoadingException e ) {
|
||||
throw new AnnotationException(
|
||||
|
@ -1227,7 +1241,7 @@ public class JPAOverriddenAnnotationReader implements AnnotationReader {
|
|||
if ( StringHelper.isNotEmpty( mapKeyClassName ) ) {
|
||||
Class clazz;
|
||||
try {
|
||||
clazz = bootstrapContext.getClassLoaderAccess().classForName(
|
||||
clazz = classLoaderAccess.classForName(
|
||||
XMLContext.buildSafeClassName( mapKeyClassName, defaults )
|
||||
);
|
||||
}
|
||||
|
@ -1910,7 +1924,7 @@ public class JPAOverriddenAnnotationReader implements AnnotationReader {
|
|||
}
|
||||
|
||||
private SqlResultSetMappings getSqlResultSetMappings(Element tree, XMLContext.Default defaults) {
|
||||
List<SqlResultSetMapping> results = buildSqlResultsetMappings( tree, defaults, bootstrapContext.getClassLoaderAccess() );
|
||||
List<SqlResultSetMapping> results = buildSqlResultsetMappings( tree, defaults, classLoaderAccess );
|
||||
if ( defaults.canUseJavaAnnotations() ) {
|
||||
SqlResultSetMapping annotation = getPhysicalAnnotation( SqlResultSetMapping.class );
|
||||
addSqlResultsetMappingIfNeeded( annotation, results );
|
||||
|
@ -2273,7 +2287,7 @@ public class JPAOverriddenAnnotationReader implements AnnotationReader {
|
|||
|
||||
private NamedQueries getNamedQueries(Element tree, XMLContext.Default defaults) {
|
||||
//TODO avoid the Proxy Creation (@NamedQueries) when possible
|
||||
List<NamedQuery> queries = (List<NamedQuery>) buildNamedQueries( tree, false, defaults, bootstrapContext.getClassLoaderAccess() );
|
||||
List<NamedQuery> queries = (List<NamedQuery>) buildNamedQueries( tree, false, defaults, classLoaderAccess );
|
||||
if ( defaults.canUseJavaAnnotations() ) {
|
||||
NamedQuery annotation = getPhysicalAnnotation( NamedQuery.class );
|
||||
addNamedQueryIfNeeded( annotation, queries );
|
||||
|
@ -2311,7 +2325,7 @@ public class JPAOverriddenAnnotationReader implements AnnotationReader {
|
|||
}
|
||||
|
||||
private NamedEntityGraphs getNamedEntityGraphs(Element tree, XMLContext.Default defaults) {
|
||||
List<NamedEntityGraph> queries = buildNamedEntityGraph( tree, defaults, bootstrapContext.getClassLoaderAccess() );
|
||||
List<NamedEntityGraph> queries = buildNamedEntityGraph( tree, defaults, classLoaderAccess );
|
||||
if ( defaults.canUseJavaAnnotations() ) {
|
||||
NamedEntityGraph annotation = getPhysicalAnnotation( NamedEntityGraph.class );
|
||||
addNamedEntityGraphIfNeeded( annotation, queries );
|
||||
|
@ -2350,7 +2364,7 @@ public class JPAOverriddenAnnotationReader implements AnnotationReader {
|
|||
}
|
||||
|
||||
private NamedStoredProcedureQueries getNamedStoredProcedureQueries(Element tree, XMLContext.Default defaults) {
|
||||
List<NamedStoredProcedureQuery> queries = buildNamedStoreProcedureQueries( tree, defaults, bootstrapContext.getClassLoaderAccess() );
|
||||
List<NamedStoredProcedureQuery> queries = buildNamedStoreProcedureQueries( tree, defaults, classLoaderAccess );
|
||||
if ( defaults.canUseJavaAnnotations() ) {
|
||||
NamedStoredProcedureQuery annotation = getPhysicalAnnotation( NamedStoredProcedureQuery.class );
|
||||
addNamedStoredProcedureQueryIfNeeded( annotation, queries );
|
||||
|
@ -2391,7 +2405,7 @@ public class JPAOverriddenAnnotationReader implements AnnotationReader {
|
|||
private NamedNativeQueries getNamedNativeQueries(
|
||||
Element tree,
|
||||
XMLContext.Default defaults) {
|
||||
List<NamedNativeQuery> queries = (List<NamedNativeQuery>) buildNamedQueries( tree, true, defaults, bootstrapContext.getClassLoaderAccess() );
|
||||
List<NamedNativeQuery> queries = (List<NamedNativeQuery>) buildNamedQueries( tree, true, defaults, classLoaderAccess );
|
||||
if ( defaults.canUseJavaAnnotations() ) {
|
||||
NamedNativeQuery annotation = getPhysicalAnnotation( NamedNativeQuery.class );
|
||||
addNamedNativeQueryIfNeeded( annotation, queries );
|
||||
|
@ -2673,8 +2687,7 @@ public class JPAOverriddenAnnotationReader implements AnnotationReader {
|
|||
AnnotationDescriptor ad = new AnnotationDescriptor( IdClass.class );
|
||||
Class clazz;
|
||||
try {
|
||||
clazz = bootstrapContext.getClassLoaderAccess().classForName(
|
||||
XMLContext.buildSafeClassName( attr.getValue(), defaults )
|
||||
clazz = classLoaderAccess.classForName( XMLContext.buildSafeClassName( attr.getValue(), defaults )
|
||||
);
|
||||
}
|
||||
catch ( ClassLoadingException e ) {
|
||||
|
|
|
@ -18,6 +18,7 @@ import org.hibernate.AnnotationException;
|
|||
import org.hibernate.boot.AttributeConverterInfo;
|
||||
import org.hibernate.boot.registry.classloading.spi.ClassLoadingException;
|
||||
import org.hibernate.boot.spi.BootstrapContext;
|
||||
import org.hibernate.boot.spi.ClassLoaderAccess;
|
||||
import org.hibernate.cfg.AttributeConverterDefinition;
|
||||
import org.hibernate.internal.CoreLogging;
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
|
@ -35,7 +36,7 @@ import org.dom4j.Element;
|
|||
public class XMLContext implements Serializable {
|
||||
private static final CoreMessageLogger LOG = CoreLogging.messageLogger( XMLContext.class );
|
||||
|
||||
private final BootstrapContext bootstrapContext;
|
||||
private final ClassLoaderAccess classLoaderAccess;
|
||||
|
||||
private Default globalDefaults;
|
||||
private Map<String, Element> classOverriding = new HashMap<>();
|
||||
|
@ -44,8 +45,16 @@ public class XMLContext implements Serializable {
|
|||
private List<String> defaultEntityListeners = new ArrayList<>();
|
||||
private boolean hasContext = false;
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link XMLContext#XMLContext(BootstrapContext)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public XMLContext(ClassLoaderAccess classLoaderAccess) {
|
||||
this.classLoaderAccess = classLoaderAccess;
|
||||
}
|
||||
|
||||
public XMLContext(BootstrapContext bootstrapContext) {
|
||||
this.bootstrapContext = bootstrapContext;
|
||||
this.classLoaderAccess = bootstrapContext.getClassLoaderAccess();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -190,7 +199,7 @@ public class XMLContext implements Serializable {
|
|||
final boolean autoApply = autoApplyAttribute != null && Boolean.parseBoolean( autoApplyAttribute );
|
||||
|
||||
try {
|
||||
final Class<? extends AttributeConverter> attributeConverterClass = bootstrapContext.getClassLoaderAccess().classForName(
|
||||
final Class<? extends AttributeConverter> attributeConverterClass = classLoaderAccess.classForName(
|
||||
className
|
||||
);
|
||||
attributeConverterInfoList.add(
|
||||
|
|
|
@ -6,7 +6,10 @@
|
|||
*/
|
||||
package org.hibernate.engine.query.spi;
|
||||
|
||||
import org.hibernate.boot.spi.SessionFactoryOptions;
|
||||
import org.hibernate.engine.query.internal.NativeQueryInterpreterStandardImpl;
|
||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||
import org.hibernate.service.spi.ServiceRegistryImplementor;
|
||||
import org.hibernate.service.spi.SessionFactoryServiceInitiator;
|
||||
import org.hibernate.service.spi.SessionFactoryServiceInitiatorContext;
|
||||
|
||||
|
@ -19,6 +22,14 @@ public class NativeQueryInterpreterInitiator implements SessionFactoryServiceIni
|
|||
*/
|
||||
public static final NativeQueryInterpreterInitiator INSTANCE = new NativeQueryInterpreterInitiator();
|
||||
|
||||
@Override
|
||||
public NativeQueryInterpreter initiateService(
|
||||
SessionFactoryImplementor sessionFactory,
|
||||
SessionFactoryOptions sessionFactoryOptions,
|
||||
ServiceRegistryImplementor registry) {
|
||||
return new NativeQueryInterpreterStandardImpl( sessionFactory );
|
||||
}
|
||||
|
||||
@Override
|
||||
public NativeQueryInterpreter initiateService(SessionFactoryServiceInitiatorContext context) {
|
||||
return new NativeQueryInterpreterStandardImpl( context.getSessionFactory() );
|
||||
|
|
|
@ -13,6 +13,7 @@ import java.util.Map;
|
|||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.boot.spi.BootstrapContext;
|
||||
import org.hibernate.boot.spi.MetadataImplementor;
|
||||
import org.hibernate.boot.spi.SessionFactoryOptions;
|
||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||
import org.hibernate.event.internal.DefaultAutoFlushEventListener;
|
||||
import org.hibernate.event.internal.DefaultDeleteEventListener;
|
||||
|
@ -46,6 +47,7 @@ import org.hibernate.jpa.event.internal.CallbackRegistryImpl;
|
|||
import org.hibernate.jpa.event.spi.CallbackBuilder;
|
||||
import org.hibernate.mapping.PersistentClass;
|
||||
import org.hibernate.resource.beans.spi.ManagedBeanRegistry;
|
||||
import org.hibernate.service.spi.ServiceRegistryImplementor;
|
||||
import org.hibernate.service.spi.Stoppable;
|
||||
|
||||
import static org.hibernate.event.spi.EventType.AUTO_FLUSH;
|
||||
|
@ -92,9 +94,23 @@ public class EventListenerRegistryImpl implements EventListenerRegistry, Stoppab
|
|||
private Map<Class,Object> listenerClassToInstanceMap = new HashMap<>();
|
||||
|
||||
private final SessionFactoryImplementor sessionFactory;
|
||||
private final CallbackRegistryImpl callbackRegistry;
|
||||
private final EventListenerGroupImpl[] registeredEventListeners;
|
||||
private CallbackBuilder callbackBuilder;
|
||||
private CallbackRegistryImpl callbackRegistry;
|
||||
private EventListenerGroupImpl[] registeredEventListeners;
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link EventListenerRegistryImpl#EventListenerRegistryImpl(BootstrapContext, SessionFactoryImplementor)} instead
|
||||
*/
|
||||
@Deprecated
|
||||
EventListenerRegistryImpl(SessionFactoryImplementor sessionFactory,
|
||||
SessionFactoryOptions sessionFactoryOptions,
|
||||
ServiceRegistryImplementor registry) {
|
||||
this.sessionFactory = sessionFactory;
|
||||
|
||||
this.callbackRegistry = new CallbackRegistryImpl();
|
||||
|
||||
this.registeredEventListeners = buildListenerGroups();
|
||||
}
|
||||
|
||||
EventListenerRegistryImpl(BootstrapContext bootstrapContext, SessionFactoryImplementor sessionFactory) {
|
||||
this.sessionFactory = sessionFactory;
|
||||
|
@ -105,7 +121,7 @@ public class EventListenerRegistryImpl implements EventListenerRegistry, Stoppab
|
|||
bootstrapContext.getReflectionManager()
|
||||
);
|
||||
|
||||
this.registeredEventListeners = buildListenerGroups( bootstrapContext );
|
||||
this.registeredEventListeners = buildListenerGroups();
|
||||
}
|
||||
|
||||
SessionFactoryImplementor getSessionFactory() {
|
||||
|
@ -118,6 +134,13 @@ public class EventListenerRegistryImpl implements EventListenerRegistry, Stoppab
|
|||
|
||||
@Override
|
||||
public void prepare(MetadataImplementor metadata) {
|
||||
if ( callbackBuilder == null ) {
|
||||
// TODO : not needed anymore when the deprecate constructor will be removed
|
||||
this.callbackBuilder = new CallbackBuilderLegacyImpl(
|
||||
sessionFactory.getServiceRegistry().getService( ManagedBeanRegistry.class ),
|
||||
metadata.getMetadataBuildingOptions().getReflectionManager()
|
||||
);
|
||||
}
|
||||
for ( PersistentClass persistentClass : metadata.getEntityBindings() ) {
|
||||
if ( persistentClass.getClassName() == null ) {
|
||||
// we can have non java class persisted by hibernate
|
||||
|
@ -218,7 +241,7 @@ public class EventListenerRegistryImpl implements EventListenerRegistry, Stoppab
|
|||
getEventListenerGroup( type ).prependListeners( listeners );
|
||||
}
|
||||
|
||||
private EventListenerGroupImpl[] buildListenerGroups(BootstrapContext bootstrapContext) {
|
||||
private EventListenerGroupImpl[] buildListenerGroups() {
|
||||
EventListenerGroupImpl[] listenerArray = new EventListenerGroupImpl[ EventType.values().size() ];
|
||||
|
||||
// auto-flush listeners
|
||||
|
|
|
@ -6,7 +6,10 @@
|
|||
*/
|
||||
package org.hibernate.event.service.internal;
|
||||
|
||||
import org.hibernate.boot.spi.SessionFactoryOptions;
|
||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||
import org.hibernate.event.service.spi.EventListenerRegistry;
|
||||
import org.hibernate.service.spi.ServiceRegistryImplementor;
|
||||
import org.hibernate.service.spi.SessionFactoryServiceInitiator;
|
||||
import org.hibernate.service.spi.SessionFactoryServiceInitiatorContext;
|
||||
|
||||
|
@ -23,8 +26,16 @@ public class EventListenerServiceInitiator implements SessionFactoryServiceIniti
|
|||
return EventListenerRegistry.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EventListenerRegistry initiateService(
|
||||
SessionFactoryImplementor sessionFactory,
|
||||
SessionFactoryOptions sessionFactoryOptions,
|
||||
ServiceRegistryImplementor registry) {
|
||||
return new EventListenerRegistryImpl( sessionFactory, sessionFactoryOptions, registry );
|
||||
}
|
||||
|
||||
@Override
|
||||
public EventListenerRegistry initiateService(SessionFactoryServiceInitiatorContext context) {
|
||||
return new EventListenerRegistryImpl( context.getBootstrapContext(), context.getSessionFactory() );
|
||||
return new EventListenerRegistryImpl( context.getSessionFactory(), context.getSessionFactoryOptions(), context.getServiceRegistry());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -190,8 +190,6 @@ public final class SessionFactoryImpl implements SessionFactoryImplementor {
|
|||
|
||||
private final transient TypeResolver typeResolver;
|
||||
private final transient TypeHelper typeHelper;
|
||||
private transient StatisticsImplementor statisticsImplementor;
|
||||
|
||||
|
||||
public SessionFactoryImpl(
|
||||
final BootstrapContext bootstrapContext,
|
||||
|
|
|
@ -11,6 +11,7 @@ import java.util.Objects;
|
|||
|
||||
import org.hibernate.MappingException;
|
||||
import org.hibernate.boot.spi.MetadataBuildingContext;
|
||||
import org.hibernate.boot.spi.MetadataImplementor;
|
||||
import org.hibernate.type.MetaType;
|
||||
import org.hibernate.type.Type;
|
||||
|
||||
|
@ -24,6 +25,14 @@ public class Any extends SimpleValue {
|
|||
private String metaTypeName = "string";
|
||||
private Map metaValues;
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link Any#Any(MetadataBuildingContext, Table)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public Any(MetadataImplementor metadata, Table table) {
|
||||
super( metadata, table );
|
||||
}
|
||||
|
||||
public Any(MetadataBuildingContext buildingContext, Table table) {
|
||||
super( buildingContext, table );
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ import org.hibernate.MappingException;
|
|||
import org.hibernate.boot.registry.classloading.spi.ClassLoaderService;
|
||||
import org.hibernate.boot.registry.classloading.spi.ClassLoadingException;
|
||||
import org.hibernate.boot.spi.MetadataBuildingContext;
|
||||
import org.hibernate.boot.spi.MetadataImplementor;
|
||||
import org.hibernate.type.CollectionType;
|
||||
import org.hibernate.type.PrimitiveType;
|
||||
|
||||
|
@ -21,6 +22,14 @@ import org.hibernate.type.PrimitiveType;
|
|||
public class Array extends List {
|
||||
private String elementClassName;
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link Array#Array(MetadataBuildingContext, PersistentClass)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public Array(MetadataImplementor metadata, PersistentClass owner) {
|
||||
super( metadata, owner );
|
||||
}
|
||||
|
||||
public Array(MetadataBuildingContext buildingContext, PersistentClass owner) {
|
||||
super( buildingContext, owner );
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
package org.hibernate.mapping;
|
||||
|
||||
import org.hibernate.boot.spi.MetadataBuildingContext;
|
||||
import org.hibernate.boot.spi.MetadataImplementor;
|
||||
import org.hibernate.type.CollectionType;
|
||||
|
||||
/**
|
||||
|
@ -15,6 +16,15 @@ import org.hibernate.type.CollectionType;
|
|||
* @author Gavin King
|
||||
*/
|
||||
public class Bag extends Collection {
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link Bag#Bag(MetadataBuildingContext, PersistentClass)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public Bag(MetadataImplementor metadata, PersistentClass owner) {
|
||||
super( metadata, owner );
|
||||
}
|
||||
|
||||
public Bag(MetadataBuildingContext buildingContext, PersistentClass owner) {
|
||||
super( buildingContext, owner );
|
||||
}
|
||||
|
|
|
@ -38,7 +38,8 @@ public abstract class Collection implements Fetchable, Value, Filterable {
|
|||
public static final String DEFAULT_ELEMENT_COLUMN_NAME = "elt";
|
||||
public static final String DEFAULT_KEY_COLUMN_NAME = "id";
|
||||
|
||||
private final MetadataBuildingContext buildingContext;
|
||||
private final MetadataImplementor metadata;
|
||||
private MetadataBuildingContext buildingContext;
|
||||
private PersistentClass owner;
|
||||
|
||||
private KeyValue key;
|
||||
|
@ -89,12 +90,20 @@ public abstract class Collection implements Fetchable, Value, Filterable {
|
|||
private String loaderName;
|
||||
|
||||
protected Collection(MetadataBuildingContext buildingContext, PersistentClass owner) {
|
||||
this.buildingContext = buildingContext;
|
||||
this(buildingContext.getMetadataCollector(), owner);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link Collection#Collection(MetadataBuildingContext, PersistentClass)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
protected Collection(MetadataImplementor metadata, PersistentClass owner) {
|
||||
this.metadata = metadata;
|
||||
this.owner = owner;
|
||||
}
|
||||
|
||||
public MetadataImplementor getMetadata() {
|
||||
return buildingContext.getMetadataCollector();
|
||||
return metadata;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -40,7 +40,7 @@ import org.hibernate.type.TypeFactory;
|
|||
* @author Steve Ebersole
|
||||
*/
|
||||
public class Component extends SimpleValue implements MetaAttributable {
|
||||
private ArrayList<Property> properties = new ArrayList<Property>();
|
||||
private ArrayList<Property> properties = new ArrayList<>();
|
||||
private String componentClassName;
|
||||
private boolean embedded;
|
||||
private String parentProperty;
|
||||
|
@ -52,6 +52,47 @@ public class Component extends SimpleValue implements MetaAttributable {
|
|||
|
||||
private java.util.Map<EntityMode,String> tuplizerImpls;
|
||||
|
||||
/**
|
||||
* @deprecated User {@link Component#Component(MetadataBuildingContext, PersistentClass)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public Component(MetadataImplementor metadata, PersistentClass owner) throws MappingException {
|
||||
this( metadata, owner.getTable(), owner );
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated User {@link Component#Component(MetadataBuildingContext, Component)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public Component(MetadataImplementor metadata, Component component) throws MappingException {
|
||||
this( metadata, component.getTable(), component.getOwner() );
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated User {@link Component#Component(MetadataBuildingContext, Join)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public Component(MetadataImplementor metadata, Join join) throws MappingException {
|
||||
this( metadata, join.getTable(), join.getPersistentClass() );
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated User {@link Component#Component(MetadataBuildingContext, Collection)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public Component(MetadataImplementor metadata, Collection collection) throws MappingException {
|
||||
this( metadata, collection.getCollectionTable(), collection.getOwner() );
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated User {@link Component#Component(MetadataBuildingContext, Table, PersistentClass)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public Component(MetadataImplementor metadata, Table table, PersistentClass owner) throws MappingException {
|
||||
super( metadata, table );
|
||||
this.owner = owner;
|
||||
}
|
||||
|
||||
public Component(MetadataBuildingContext metadata, PersistentClass owner) throws MappingException {
|
||||
this( metadata, owner.getTable(), owner );
|
||||
}
|
||||
|
@ -122,8 +163,7 @@ public class Component extends SimpleValue implements MetaAttributable {
|
|||
}
|
||||
|
||||
public Class getComponentClass() throws MappingException {
|
||||
final ClassLoaderService classLoaderService = getMetadataBuildingContext()
|
||||
.getBootstrapContext()
|
||||
final ClassLoaderService classLoaderService = getMetadata()
|
||||
.getMetadataBuildingOptions()
|
||||
.getServiceRegistry()
|
||||
.getService( ClassLoaderService.class );
|
||||
|
@ -172,7 +212,7 @@ public class Component extends SimpleValue implements MetaAttributable {
|
|||
// TODO : temporary initial step towards HHH-1907
|
||||
final ComponentMetamodel metamodel = new ComponentMetamodel(
|
||||
this,
|
||||
getMetadataBuildingContext().getBootstrapContext()
|
||||
getMetadata().getMetadataBuildingOptions()
|
||||
);
|
||||
final TypeFactory factory = getMetadata().getTypeResolver().getTypeFactory();
|
||||
return isEmbedded() ? factory.embeddedComponent( metamodel ) : factory.component( metamodel );
|
||||
|
@ -263,7 +303,7 @@ public class Component extends SimpleValue implements MetaAttributable {
|
|||
|
||||
public void addTuplizer(EntityMode entityMode, String implClassName) {
|
||||
if ( tuplizerImpls == null ) {
|
||||
tuplizerImpls = new HashMap<EntityMode,String>();
|
||||
tuplizerImpls = new HashMap<>();
|
||||
}
|
||||
tuplizerImpls.put( entityMode, implClassName );
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ package org.hibernate.mapping;
|
|||
|
||||
import org.hibernate.MappingException;
|
||||
import org.hibernate.boot.spi.MetadataBuildingContext;
|
||||
import org.hibernate.boot.spi.MetadataImplementor;
|
||||
import org.hibernate.type.Type;
|
||||
|
||||
/**
|
||||
|
@ -22,6 +23,15 @@ public class DependantValue extends SimpleValue {
|
|||
private boolean nullable;
|
||||
private boolean updateable;
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link DependantValue#DependantValue(MetadataBuildingContext, Table, KeyValue)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public DependantValue(MetadataImplementor metadata, Table table, KeyValue prototype) {
|
||||
super( metadata, table );
|
||||
this.wrappedValue = prototype;
|
||||
}
|
||||
|
||||
public DependantValue(MetadataBuildingContext buildingContext, Table table, KeyValue prototype) {
|
||||
super( buildingContext, table );
|
||||
this.wrappedValue = prototype;
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
package org.hibernate.mapping;
|
||||
|
||||
import org.hibernate.boot.spi.MetadataBuildingContext;
|
||||
import org.hibernate.boot.spi.MetadataImplementor;
|
||||
import org.hibernate.type.CollectionType;
|
||||
|
||||
/**
|
||||
|
@ -14,6 +15,14 @@ import org.hibernate.type.CollectionType;
|
|||
* just the identifier column
|
||||
*/
|
||||
public class IdentifierBag extends IdentifierCollection {
|
||||
/**
|
||||
* @deprecated User {@link IdentifierBag#IdentifierBag(MetadataBuildingContext, PersistentClass)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public IdentifierBag(MetadataImplementor metadata, PersistentClass owner) {
|
||||
super( metadata, owner );
|
||||
}
|
||||
|
||||
public IdentifierBag(MetadataBuildingContext buildingContext, PersistentClass owner) {
|
||||
super( buildingContext, owner );
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ package org.hibernate.mapping;
|
|||
|
||||
import org.hibernate.MappingException;
|
||||
import org.hibernate.boot.spi.MetadataBuildingContext;
|
||||
import org.hibernate.boot.spi.MetadataImplementor;
|
||||
import org.hibernate.engine.spi.Mapping;
|
||||
|
||||
/**
|
||||
|
@ -19,6 +20,14 @@ public abstract class IdentifierCollection extends Collection {
|
|||
|
||||
private KeyValue identifier;
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link IdentifierCollection#IdentifierCollection(MetadataBuildingContext, PersistentClass)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public IdentifierCollection(MetadataImplementor metadata, PersistentClass owner) {
|
||||
super( metadata, owner );
|
||||
}
|
||||
|
||||
public IdentifierCollection(MetadataBuildingContext buildingContext, PersistentClass owner) {
|
||||
super( buildingContext, owner );
|
||||
}
|
||||
|
@ -50,12 +59,6 @@ public abstract class IdentifierCollection extends Collection {
|
|||
pk.addColumns( getIdentifier().getColumnIterator() );
|
||||
getCollectionTable().setPrimaryKey(pk);
|
||||
}
|
||||
else {
|
||||
// don't create a unique key, 'cos some
|
||||
// databases don't like a UK on nullable
|
||||
// columns
|
||||
//getCollectionTable().createUniqueKey( getIdentifier().getConstraintColumns() );
|
||||
}
|
||||
// create an index on the key columns??
|
||||
}
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@ import java.util.Iterator;
|
|||
|
||||
import org.hibernate.MappingException;
|
||||
import org.hibernate.boot.spi.MetadataBuildingContext;
|
||||
import org.hibernate.boot.spi.MetadataImplementor;
|
||||
import org.hibernate.engine.spi.Mapping;
|
||||
|
||||
/**
|
||||
|
@ -23,6 +24,14 @@ public abstract class IndexedCollection extends Collection {
|
|||
|
||||
private Value index;
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link IndexedCollection#IndexedCollection(MetadataBuildingContext, PersistentClass)} insetad.
|
||||
*/
|
||||
@Deprecated
|
||||
public IndexedCollection(MetadataImplementor metadata, PersistentClass owner) {
|
||||
super( metadata, owner );
|
||||
}
|
||||
|
||||
public IndexedCollection(MetadataBuildingContext buildingContext, PersistentClass owner) {
|
||||
super( buildingContext, owner );
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ package org.hibernate.mapping;
|
|||
|
||||
import org.hibernate.MappingException;
|
||||
import org.hibernate.boot.spi.MetadataBuildingContext;
|
||||
import org.hibernate.boot.spi.MetadataImplementor;
|
||||
import org.hibernate.type.CollectionType;
|
||||
|
||||
/**
|
||||
|
@ -23,6 +24,14 @@ public class List extends IndexedCollection {
|
|||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link List#List(MetadataBuildingContext, PersistentClass)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public List(MetadataImplementor metadata, PersistentClass owner) {
|
||||
super( metadata, owner );
|
||||
}
|
||||
|
||||
public List(MetadataBuildingContext buildingContext, PersistentClass owner) {
|
||||
super( buildingContext, owner );
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ import java.util.Map;
|
|||
|
||||
import org.hibernate.MappingException;
|
||||
import org.hibernate.boot.spi.MetadataBuildingContext;
|
||||
import org.hibernate.boot.spi.MetadataImplementor;
|
||||
import org.hibernate.type.EntityType;
|
||||
import org.hibernate.type.Type;
|
||||
|
||||
|
@ -22,7 +23,15 @@ import org.hibernate.type.Type;
|
|||
public class ManyToOne extends ToOne {
|
||||
private boolean ignoreNotFound;
|
||||
private boolean isLogicalOneToOne;
|
||||
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link ManyToOne#ManyToOne(MetadataBuildingContext, Table)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public ManyToOne(MetadataImplementor metadata, Table table) {
|
||||
super( metadata, table );
|
||||
}
|
||||
|
||||
public ManyToOne(MetadataBuildingContext buildingContext, Table table) {
|
||||
super( buildingContext, table );
|
||||
}
|
||||
|
@ -68,7 +77,7 @@ public class ManyToOne extends ToOne {
|
|||
Iterator iter = property.getColumnIterator();
|
||||
while ( iter.hasNext() ) {
|
||||
Column col = (Column) iter.next();
|
||||
refColumns.add( col );
|
||||
refColumns.add( col );
|
||||
}
|
||||
|
||||
ForeignKey fk = getTable().createForeignKey(
|
||||
|
|
|
@ -8,6 +8,7 @@ package org.hibernate.mapping;
|
|||
|
||||
import org.hibernate.MappingException;
|
||||
import org.hibernate.boot.spi.MetadataBuildingContext;
|
||||
import org.hibernate.boot.spi.MetadataImplementor;
|
||||
import org.hibernate.type.CollectionType;
|
||||
|
||||
/**
|
||||
|
@ -16,6 +17,14 @@ import org.hibernate.type.CollectionType;
|
|||
*/
|
||||
public class Map extends IndexedCollection {
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link Map#Map(MetadataBuildingContext, PersistentClass)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public Map(MetadataImplementor metadata, PersistentClass owner) {
|
||||
super( metadata, owner );
|
||||
}
|
||||
|
||||
public Map(MetadataBuildingContext buildingContext, PersistentClass owner) {
|
||||
super( buildingContext, owner );
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ import java.util.Objects;
|
|||
import org.hibernate.FetchMode;
|
||||
import org.hibernate.MappingException;
|
||||
import org.hibernate.boot.spi.MetadataBuildingContext;
|
||||
import org.hibernate.boot.spi.MetadataImplementor;
|
||||
import org.hibernate.engine.spi.Mapping;
|
||||
import org.hibernate.service.ServiceRegistry;
|
||||
import org.hibernate.type.EntityType;
|
||||
|
@ -23,26 +24,34 @@ import org.hibernate.type.Type;
|
|||
* @author Gavin King
|
||||
*/
|
||||
public class OneToMany implements Value {
|
||||
private final MetadataBuildingContext buildingContext;
|
||||
private final MetadataImplementor metadata;
|
||||
private final Table referencingTable;
|
||||
|
||||
private String referencedEntityName;
|
||||
private PersistentClass associatedClass;
|
||||
private boolean embedded;
|
||||
private boolean ignoreNotFound;
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link OneToMany#OneToMany(MetadataBuildingContext, PersistentClass)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public OneToMany(MetadataImplementor metadata, PersistentClass owner) throws MappingException {
|
||||
this.metadata = metadata;
|
||||
this.referencingTable = ( owner == null ) ? null : owner.getTable();
|
||||
}
|
||||
|
||||
public OneToMany(MetadataBuildingContext buildingContext, PersistentClass owner) throws MappingException {
|
||||
this.buildingContext = buildingContext;
|
||||
this.metadata = buildingContext.getMetadataCollector();
|
||||
this.referencingTable = ( owner == null ) ? null : owner.getTable();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ServiceRegistry getServiceRegistry() {
|
||||
return buildingContext.getBootstrapContext().getServiceRegistry();
|
||||
return metadata.getMetadataBuildingOptions().getServiceRegistry();
|
||||
}
|
||||
|
||||
private EntityType getEntityType() {
|
||||
return buildingContext.getMetadataCollector().getTypeResolver().getTypeFactory().manyToOne(
|
||||
return metadata.getTypeResolver().getTypeFactory().manyToOne(
|
||||
getReferencedEntityName(),
|
||||
true,
|
||||
null,
|
||||
|
|
|
@ -12,6 +12,7 @@ import java.util.Objects;
|
|||
|
||||
import org.hibernate.MappingException;
|
||||
import org.hibernate.boot.spi.MetadataBuildingContext;
|
||||
import org.hibernate.boot.spi.MetadataImplementor;
|
||||
import org.hibernate.type.EntityType;
|
||||
import org.hibernate.type.ForeignKeyDirection;
|
||||
import org.hibernate.type.Type;
|
||||
|
@ -28,6 +29,16 @@ public class OneToOne extends ToOne {
|
|||
private String propertyName;
|
||||
private String entityName;
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link OneToOne#OneToOne(MetadataBuildingContext, Table, PersistentClass)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public OneToOne(MetadataImplementor metadata, Table table, PersistentClass owner) throws MappingException {
|
||||
super( metadata, table );
|
||||
this.identifier = owner.getKey();
|
||||
this.entityName = owner.getEntityName();
|
||||
}
|
||||
|
||||
public OneToOne(MetadataBuildingContext buildingContext, Table table, PersistentClass owner) throws MappingException {
|
||||
super( buildingContext, table );
|
||||
this.identifier = owner.getKey();
|
||||
|
|
|
@ -54,20 +54,20 @@ public abstract class PersistentClass implements AttributeContainer, Serializabl
|
|||
|
||||
private String discriminatorValue;
|
||||
private boolean lazy;
|
||||
private ArrayList properties = new ArrayList();
|
||||
private ArrayList declaredProperties = new ArrayList();
|
||||
private final ArrayList<Subclass> subclasses = new ArrayList<Subclass>();
|
||||
private final ArrayList subclassProperties = new ArrayList();
|
||||
private final ArrayList subclassTables = new ArrayList();
|
||||
private java.util.List<Property> properties = new ArrayList<>();
|
||||
private java.util.List<Property> declaredProperties = new ArrayList<>();
|
||||
private final java.util.List<Subclass> subclasses = new ArrayList<>();
|
||||
private final java.util.List<Property> subclassProperties = new ArrayList<>();
|
||||
private final java.util.List<Table> subclassTables = new ArrayList<>();
|
||||
private boolean dynamicInsert;
|
||||
private boolean dynamicUpdate;
|
||||
private int batchSize = -1;
|
||||
private boolean selectBeforeUpdate;
|
||||
private java.util.Map metaAttributes;
|
||||
private ArrayList<Join> joins = new ArrayList<Join>();
|
||||
private final ArrayList subclassJoins = new ArrayList();
|
||||
private final java.util.List filters = new ArrayList();
|
||||
protected final java.util.Set synchronizedTables = new HashSet();
|
||||
private java.util.List<Join> joins = new ArrayList<>();
|
||||
private final java.util.List<Join> subclassJoins = new ArrayList<>();
|
||||
private final java.util.List<FilterConfiguration> filters = new ArrayList<>();
|
||||
protected final java.util.Set<String> synchronizedTables = new HashSet<>();
|
||||
private String loaderName;
|
||||
private Boolean isAbstract;
|
||||
private boolean hasSubselectLoadableCollections;
|
||||
|
@ -330,7 +330,7 @@ public abstract class PersistentClass implements AttributeContainer, Serializabl
|
|||
iters.add( getPropertyClosureIterator() );
|
||||
iters.add( subclassProperties.iterator() );
|
||||
for ( int i = 0; i < subclassJoins.size(); i++ ) {
|
||||
Join join = (Join) subclassJoins.get( i );
|
||||
Join join = subclassJoins.get( i );
|
||||
iters.add( join.getPropertyIterator() );
|
||||
}
|
||||
return new JoinedIterator( iters );
|
||||
|
@ -635,7 +635,7 @@ public abstract class PersistentClass implements AttributeContainer, Serializabl
|
|||
}
|
||||
|
||||
private void checkPropertyDuplication() throws MappingException {
|
||||
HashSet<String> names = new HashSet<String>();
|
||||
HashSet<String> names = new HashSet<>();
|
||||
Iterator iter = getPropertyIterator();
|
||||
while ( iter.hasNext() ) {
|
||||
Property prop = (Property) iter.next();
|
||||
|
@ -727,7 +727,7 @@ public abstract class PersistentClass implements AttributeContainer, Serializabl
|
|||
ArrayList iterators = new ArrayList();
|
||||
iterators.add( properties.iterator() );
|
||||
for ( int i = 0; i < joins.size(); i++ ) {
|
||||
Join join = (Join) joins.get( i );
|
||||
Join join = joins.get( i );
|
||||
iterators.add( join.getPropertyIterator() );
|
||||
}
|
||||
return new JoinedIterator( iterators );
|
||||
|
@ -987,7 +987,7 @@ public abstract class PersistentClass implements AttributeContainer, Serializabl
|
|||
ArrayList iterators = new ArrayList();
|
||||
iterators.add( declaredProperties.iterator() );
|
||||
for ( int i = 0; i < joins.size(); i++ ) {
|
||||
Join join = (Join) joins.get( i );
|
||||
Join join = joins.get( i );
|
||||
iterators.add( join.getDeclaredPropertyIterator() );
|
||||
}
|
||||
return new JoinedIterator( iterators );
|
||||
|
|
|
@ -7,11 +7,20 @@
|
|||
package org.hibernate.mapping;
|
||||
|
||||
import org.hibernate.boot.spi.MetadataBuildingContext;
|
||||
import org.hibernate.boot.spi.MetadataImplementor;
|
||||
|
||||
/**
|
||||
* A primitive array has a primary key consisting of the key columns + index column.
|
||||
*/
|
||||
public class PrimitiveArray extends Array {
|
||||
/**
|
||||
* @deprecated Use {@link PrimitiveArray#PrimitiveArray(MetadataBuildingContext, PersistentClass)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public PrimitiveArray(MetadataImplementor metadata, PersistentClass owner) {
|
||||
super( metadata, owner );
|
||||
}
|
||||
|
||||
public PrimitiveArray(MetadataBuildingContext buildingContext, PersistentClass owner) {
|
||||
super( buildingContext, owner );
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ import java.util.Iterator;
|
|||
|
||||
import org.hibernate.MappingException;
|
||||
import org.hibernate.boot.spi.MetadataBuildingContext;
|
||||
import org.hibernate.boot.spi.MetadataImplementor;
|
||||
import org.hibernate.engine.spi.Mapping;
|
||||
import org.hibernate.type.CollectionType;
|
||||
|
||||
|
@ -19,6 +20,14 @@ import org.hibernate.type.CollectionType;
|
|||
* @author Gavin King
|
||||
*/
|
||||
public class Set extends Collection {
|
||||
/**
|
||||
* @deprecated Use {@link Set#Set(MetadataBuildingContext, PersistentClass)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public Set(MetadataImplementor metadata, PersistentClass owner) {
|
||||
super( metadata, owner );
|
||||
}
|
||||
|
||||
public Set(MetadataBuildingContext buildingContext, PersistentClass owner) {
|
||||
super( buildingContext, owner );
|
||||
}
|
||||
|
|
|
@ -25,6 +25,7 @@ import org.hibernate.boot.model.convert.spi.ConverterDescriptor;
|
|||
import org.hibernate.boot.model.convert.spi.JpaAttributeConverterCreationContext;
|
||||
import org.hibernate.boot.registry.classloading.spi.ClassLoaderService;
|
||||
import org.hibernate.boot.registry.classloading.spi.ClassLoadingException;
|
||||
import org.hibernate.boot.spi.InFlightMetadataCollector;
|
||||
import org.hibernate.boot.spi.MetadataBuildingContext;
|
||||
import org.hibernate.boot.spi.MetadataImplementor;
|
||||
import org.hibernate.cfg.AvailableSettings;
|
||||
|
@ -67,7 +68,8 @@ public class SimpleValue implements KeyValue {
|
|||
|
||||
public static final String DEFAULT_ID_GEN_STRATEGY = "assigned";
|
||||
|
||||
private final MetadataBuildingContext buildingContext;
|
||||
private MetadataBuildingContext buildingContext;
|
||||
private MetadataImplementor metadata;
|
||||
|
||||
private final List<Selectable> columns = new ArrayList<Selectable>();
|
||||
private final List<Boolean> insertability = new ArrayList<Boolean>();
|
||||
|
@ -91,8 +93,25 @@ public class SimpleValue implements KeyValue {
|
|||
private ConverterDescriptor attributeConverterDescriptor;
|
||||
private Type type;
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link SimpleValue#SimpleValue(MetadataBuildingContext)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public SimpleValue(MetadataImplementor metadata) {
|
||||
this.metadata = metadata;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link SimpleValue#SimpleValue(MetadataBuildingContext, Table)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public SimpleValue(MetadataImplementor metadata, Table table) {
|
||||
this( metadata );
|
||||
this.table = table;
|
||||
}
|
||||
|
||||
public SimpleValue(MetadataBuildingContext buildingContext) {
|
||||
this.buildingContext = buildingContext;
|
||||
this(buildingContext.getMetadataCollector());
|
||||
}
|
||||
|
||||
public SimpleValue(MetadataBuildingContext buildingContext, Table table) {
|
||||
|
@ -100,18 +119,13 @@ public class SimpleValue implements KeyValue {
|
|||
this.table = table;
|
||||
}
|
||||
|
||||
public MetadataImplementor getMetadata(){
|
||||
return buildingContext.getMetadataCollector();
|
||||
public MetadataImplementor getMetadata() {
|
||||
return metadata;
|
||||
}
|
||||
|
||||
public MetadataBuildingContext getMetadataBuildingContext() {
|
||||
return buildingContext;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ServiceRegistry getServiceRegistry() {
|
||||
return buildingContext.getBootstrapContext().getServiceRegistry();
|
||||
return getMetadata().getMetadataBuildingOptions().getServiceRegistry();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -185,7 +199,8 @@ public class SimpleValue implements KeyValue {
|
|||
public void setTypeName(String typeName) {
|
||||
if ( typeName != null && typeName.startsWith( AttributeConverterTypeAdapter.NAME_PREFIX ) ) {
|
||||
final String converterClassName = typeName.substring( AttributeConverterTypeAdapter.NAME_PREFIX.length() );
|
||||
final ClassLoaderService cls = buildingContext.getBootstrapContext().getMetadataBuildingOptions()
|
||||
final ClassLoaderService cls = getMetadata()
|
||||
.getMetadataBuildingOptions()
|
||||
.getServiceRegistry()
|
||||
.getService( ClassLoaderService.class );
|
||||
try {
|
||||
|
@ -193,7 +208,7 @@ public class SimpleValue implements KeyValue {
|
|||
this.attributeConverterDescriptor = new ClassBasedConverterDescriptor(
|
||||
converterClass,
|
||||
false,
|
||||
buildingContext.getBootstrapContext().getClassmateContext()
|
||||
( (InFlightMetadataCollector) getMetadata() ).getClassmateContext()
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
@ -307,7 +322,7 @@ public class SimpleValue implements KeyValue {
|
|||
}
|
||||
|
||||
// TODO : we should pass along all settings once "config lifecycle" is hashed out...
|
||||
final ConfigurationService cs = buildingContext.getBootstrapContext().getServiceRegistry()
|
||||
final ConfigurationService cs = metadata.getMetadataBuildingOptions().getServiceRegistry()
|
||||
.getService( ConfigurationService.class );
|
||||
|
||||
params.put(
|
||||
|
@ -496,8 +511,7 @@ public class SimpleValue implements KeyValue {
|
|||
typeName = ReflectHelper.reflectedPropertyClass(
|
||||
className,
|
||||
propertyName,
|
||||
buildingContext
|
||||
.getBootstrapContext()
|
||||
getMetadata()
|
||||
.getMetadataBuildingOptions()
|
||||
.getServiceRegistry()
|
||||
.getService( ClassLoaderService.class )
|
||||
|
@ -553,8 +567,7 @@ public class SimpleValue implements KeyValue {
|
|||
new JpaAttributeConverterCreationContext() {
|
||||
@Override
|
||||
public ManagedBeanRegistry getManagedBeanRegistry() {
|
||||
return buildingContext
|
||||
.getBootstrapContext()
|
||||
return getMetadata()
|
||||
.getMetadataBuildingOptions()
|
||||
.getServiceRegistry()
|
||||
.getService( ManagedBeanRegistry.class );
|
||||
|
@ -602,8 +615,7 @@ public class SimpleValue implements KeyValue {
|
|||
}
|
||||
|
||||
// find the standard SqlTypeDescriptor for that JDBC type code (allow itr to be remapped if needed!)
|
||||
final SqlTypeDescriptor sqlTypeDescriptor = buildingContext
|
||||
.getBootstrapContext()
|
||||
final SqlTypeDescriptor sqlTypeDescriptor = getMetadata()
|
||||
.getMetadataBuildingOptions()
|
||||
.getServiceRegistry()
|
||||
.getService( JdbcServices.class )
|
||||
|
@ -722,8 +734,7 @@ public class SimpleValue implements KeyValue {
|
|||
? null
|
||||
: xProperty.getAnnotations();
|
||||
|
||||
final ClassLoaderService classLoaderService = buildingContext
|
||||
.getBootstrapContext()
|
||||
final ClassLoaderService classLoaderService = getMetadata()
|
||||
.getMetadataBuildingOptions()
|
||||
.getServiceRegistry()
|
||||
.getService( ClassLoaderService.class );
|
||||
|
|
|
@ -10,6 +10,7 @@ import org.hibernate.FetchMode;
|
|||
import org.hibernate.MappingException;
|
||||
import org.hibernate.boot.registry.classloading.spi.ClassLoaderService;
|
||||
import org.hibernate.boot.spi.MetadataBuildingContext;
|
||||
import org.hibernate.boot.spi.MetadataImplementor;
|
||||
import org.hibernate.engine.spi.Mapping;
|
||||
import org.hibernate.internal.util.ReflectHelper;
|
||||
import org.hibernate.type.Type;
|
||||
|
@ -30,6 +31,14 @@ public abstract class ToOne extends SimpleValue implements Fetchable {
|
|||
protected boolean unwrapProxy;
|
||||
protected boolean referenceToPrimaryKey = true;
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link ToOne#ToOne(MetadataBuildingContext, Table)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
protected ToOne(MetadataImplementor metadata, Table table) {
|
||||
super( metadata, table );
|
||||
}
|
||||
|
||||
protected ToOne(MetadataBuildingContext buildingContext, Table table) {
|
||||
super( buildingContext, table );
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ public class SessionFactoryServiceRegistryImpl
|
|||
private final SessionFactoryImplementor sessionFactory;
|
||||
private EventListenerRegistry cachedEventListenerRegistry;
|
||||
|
||||
private BootstrapContext bootstrapContext;
|
||||
private final BootstrapContext bootstrapContext;
|
||||
|
||||
@SuppressWarnings( {"unchecked"})
|
||||
public SessionFactoryServiceRegistryImpl(
|
||||
|
@ -47,7 +47,6 @@ public class SessionFactoryServiceRegistryImpl
|
|||
|
||||
this.sessionFactory = sessionFactory;
|
||||
this.sessionFactoryOptions = sessionFactoryOptions;
|
||||
|
||||
this.bootstrapContext = bootstrapContext;
|
||||
|
||||
// for now, just use the standard initiator list
|
||||
|
|
|
@ -19,5 +19,5 @@ public interface ServiceInitiator<R extends Service> {
|
|||
*
|
||||
* @return The service role.
|
||||
*/
|
||||
public Class<R> getServiceInitiated();
|
||||
Class<R> getServiceInitiated();
|
||||
}
|
||||
|
|
|
@ -23,22 +23,22 @@ public interface ServiceRegistryImplementor extends ServiceRegistry {
|
|||
*
|
||||
* @return The located binding; may be {@code null}
|
||||
*/
|
||||
public <R extends Service> ServiceBinding<R> locateServiceBinding(Class<R> serviceRole);
|
||||
<R extends Service> ServiceBinding<R> locateServiceBinding(Class<R> serviceRole);
|
||||
|
||||
/**
|
||||
* Release resources
|
||||
*/
|
||||
public void destroy();
|
||||
void destroy();
|
||||
|
||||
/**
|
||||
* When a registry is created with a parent, the parent is notified of the child
|
||||
* via this callback.
|
||||
*/
|
||||
public void registerChild(ServiceRegistryImplementor child);
|
||||
void registerChild(ServiceRegistryImplementor child);
|
||||
|
||||
/**
|
||||
* When a registry is created with a parent, the parent is notified of the child
|
||||
* via this callback.
|
||||
*/
|
||||
public void deRegisterChild(ServiceRegistryImplementor child);
|
||||
void deRegisterChild(ServiceRegistryImplementor child);
|
||||
}
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
*/
|
||||
package org.hibernate.service.spi;
|
||||
|
||||
import org.hibernate.boot.spi.SessionFactoryOptions;
|
||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||
import org.hibernate.service.Service;
|
||||
|
||||
/**
|
||||
|
@ -24,6 +26,31 @@ public interface SessionFactoryServiceInitiator<R extends Service> extends Servi
|
|||
*
|
||||
* @return The initiated service.
|
||||
*/
|
||||
R initiateService(SessionFactoryServiceInitiatorContext context);
|
||||
default R initiateService(SessionFactoryServiceInitiatorContext context) {
|
||||
return initiateService(
|
||||
context.getSessionFactory(),
|
||||
context.getSessionFactoryOptions(),
|
||||
context.getServiceRegistry()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initiates the managed service.
|
||||
* <p/>
|
||||
* Note for implementors: signature is guaranteed to change once redesign of SessionFactory building is complete
|
||||
*
|
||||
* @param sessionFactory The session factory. Note the the session factory is still in flux; care needs to be taken
|
||||
* in regards to what you call.
|
||||
* @param sessionFactoryOptions Options specified for building the SessionFactory
|
||||
* @param registry The service registry. Can be used to locate services needed to fulfill initiation.
|
||||
*
|
||||
* @return The initiated service.
|
||||
*
|
||||
* @deprecated Use {@link SessionFactoryServiceInitiator#initiateService(SessionFactoryServiceInitiatorContext)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
R initiateService(
|
||||
SessionFactoryImplementor sessionFactory,
|
||||
SessionFactoryOptions sessionFactoryOptions,
|
||||
ServiceRegistryImplementor registry);
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ package org.hibernate.stat.internal;
|
|||
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.boot.registry.classloading.spi.ClassLoaderService;
|
||||
import org.hibernate.boot.spi.SessionFactoryOptions;
|
||||
import org.hibernate.engine.config.spi.ConfigurationService;
|
||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
|
@ -47,6 +48,18 @@ public class StatisticsInitiator implements SessionFactoryServiceInitiator<Stati
|
|||
return initiateServiceInternal( context.getSessionFactory(), configValue, context.getServiceRegistry() );
|
||||
}
|
||||
|
||||
@Override
|
||||
public StatisticsImplementor initiateService(
|
||||
SessionFactoryImplementor sessionFactory,
|
||||
SessionFactoryOptions sessionFactoryOptions,
|
||||
ServiceRegistryImplementor registry) {
|
||||
final Object configValue = registry
|
||||
.getService( ConfigurationService.class )
|
||||
.getSettings()
|
||||
.get( STATS_BUILDER );
|
||||
return initiateServiceInternal( sessionFactory, configValue, registry );
|
||||
}
|
||||
|
||||
private StatisticsImplementor initiateServiceInternal(
|
||||
SessionFactoryImplementor sessionFactory,
|
||||
Object configValue,
|
||||
|
|
|
@ -32,7 +32,6 @@ public class ComponentMetamodel implements Serializable {
|
|||
|
||||
// TODO : will need reference to session factory to fully complete HHH-1907
|
||||
|
||||
// private final SessionFactoryImplementor sessionFactory;
|
||||
private final String role;
|
||||
private final boolean isKey;
|
||||
private final StandardProperty[] properties;
|
||||
|
@ -45,9 +44,19 @@ public class ComponentMetamodel implements Serializable {
|
|||
private final Map propertyIndexes = new HashMap();
|
||||
private final boolean createEmptyCompositesEnabled;
|
||||
|
||||
// public ComponentMetamodel(Component component, SessionFactoryImplementor sessionFactory) {
|
||||
/**
|
||||
* @deprecated Use {@link ComponentMetamodel#ComponentMetamodel(Component, BootstrapContext)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public ComponentMetamodel(Component component, MetadataBuildingOptions metadataBuildingOptions) {
|
||||
this( component, new ComponentTuplizerFactory( metadataBuildingOptions ) );
|
||||
}
|
||||
|
||||
public ComponentMetamodel(Component component, BootstrapContext bootstrapContext) {
|
||||
// this.sessionFactory = sessionFactory;
|
||||
this( component, new ComponentTuplizerFactory( bootstrapContext ) );
|
||||
}
|
||||
|
||||
private ComponentMetamodel(Component component, ComponentTuplizerFactory componentTuplizerFactory){
|
||||
this.role = component.getRoleName();
|
||||
this.isKey = component.isKey();
|
||||
propertySpan = component.getPropertySpan();
|
||||
|
@ -64,7 +73,6 @@ public class ComponentMetamodel implements Serializable {
|
|||
entityMode = component.hasPojoRepresentation() ? EntityMode.POJO : EntityMode.MAP;
|
||||
|
||||
// todo : move this to SF per HHH-3517; also see HHH-1907 and ComponentMetamodel
|
||||
final ComponentTuplizerFactory componentTuplizerFactory = new ComponentTuplizerFactory( bootstrapContext );
|
||||
final String tuplizerClassName = component.getTuplizerImplClassName( entityMode );
|
||||
this.componentTuplizer = tuplizerClassName == null ? componentTuplizerFactory.constructDefaultTuplizer(
|
||||
entityMode,
|
||||
|
|
|
@ -34,6 +34,17 @@ public class ComponentTuplizerFactory implements Serializable {
|
|||
|
||||
private final ClassLoaderAccess classLoaderAccess;
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link ComponentTuplizerFactory#ComponentTuplizerFactory(BootstrapContext)} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public ComponentTuplizerFactory(MetadataBuildingOptions metadataBuildingOptions) {
|
||||
classLoaderAccess = new ClassLoaderAccessImpl(
|
||||
metadataBuildingOptions.getTempClassLoader(),
|
||||
metadataBuildingOptions.getServiceRegistry().getService( ClassLoaderService.class )
|
||||
);
|
||||
}
|
||||
|
||||
public ComponentTuplizerFactory(BootstrapContext bootstrapContext) {
|
||||
classLoaderAccess = bootstrapContext.getClassLoaderAccess();
|
||||
}
|
||||
|
|
|
@ -30,7 +30,6 @@ import org.hibernate.boot.jaxb.internal.MappingBinder;
|
|||
import org.hibernate.boot.jaxb.spi.Binding;
|
||||
import org.hibernate.boot.model.source.internal.hbm.MappingDocument;
|
||||
import org.hibernate.boot.spi.AdditionalJaxbMappingProducer;
|
||||
import org.hibernate.boot.spi.InFlightMetadataCollector;
|
||||
import org.hibernate.boot.spi.MetadataBuildingContext;
|
||||
import org.hibernate.boot.spi.MetadataImplementor;
|
||||
import org.hibernate.envers.configuration.internal.MappingCollector;
|
||||
|
@ -46,7 +45,7 @@ public class AdditionalJaxbMappingProducerImpl implements AdditionalJaxbMappingP
|
|||
|
||||
@Override
|
||||
public Collection<MappingDocument> produceAdditionalMappings(
|
||||
final InFlightMetadataCollector metadata,
|
||||
final MetadataImplementor metadata,
|
||||
IndexView jandexIndex,
|
||||
final MappingBinder mappingBinder,
|
||||
final MetadataBuildingContext buildingContext) {
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
package org.hibernate.envers.boot.internal;
|
||||
|
||||
import org.hibernate.boot.registry.classloading.spi.ClassLoaderService;
|
||||
import org.hibernate.boot.spi.InFlightMetadataCollector;
|
||||
import org.hibernate.boot.spi.MetadataImplementor;
|
||||
import org.hibernate.envers.configuration.internal.AuditEntitiesConfiguration;
|
||||
import org.hibernate.envers.configuration.internal.GlobalConfiguration;
|
||||
import org.hibernate.envers.configuration.internal.MappingCollector;
|
||||
|
@ -54,7 +54,7 @@ public interface EnversService extends Service {
|
|||
*/
|
||||
boolean isInitialized();
|
||||
|
||||
void initialize(InFlightMetadataCollector metadata, MappingCollector mappingCollector);
|
||||
void initialize(MetadataImplementor metadata, MappingCollector mappingCollector);
|
||||
|
||||
XMLHelper getXmlHelper();
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ import java.util.Properties;
|
|||
import org.hibernate.MappingException;
|
||||
import org.hibernate.annotations.common.reflection.ReflectionManager;
|
||||
import org.hibernate.boot.registry.classloading.spi.ClassLoaderService;
|
||||
import org.hibernate.boot.spi.InFlightMetadataCollector;
|
||||
import org.hibernate.boot.spi.MetadataImplementor;
|
||||
import org.hibernate.engine.config.spi.ConfigurationService;
|
||||
import org.hibernate.envers.configuration.internal.AuditEntitiesConfiguration;
|
||||
import org.hibernate.envers.configuration.internal.EntitiesConfigurator;
|
||||
|
@ -103,7 +103,7 @@ public class EnversServiceImpl implements EnversService, Configurable, Stoppable
|
|||
}
|
||||
|
||||
@Override
|
||||
public void initialize(final InFlightMetadataCollector metadata, final MappingCollector mappingCollector) {
|
||||
public void initialize(final MetadataImplementor metadata, final MappingCollector mappingCollector) {
|
||||
if ( initialized ) {
|
||||
throw new UnsupportedOperationException( "EnversService#initialize should be called only once" );
|
||||
}
|
||||
|
@ -119,7 +119,7 @@ public class EnversServiceImpl implements EnversService, Configurable, Stoppable
|
|||
}
|
||||
|
||||
private void doInitialize(
|
||||
final InFlightMetadataCollector metadata,
|
||||
final MetadataImplementor metadata,
|
||||
final MappingCollector mappingCollector,
|
||||
ServiceRegistry serviceRegistry) {
|
||||
final ConfigurationService cfgService = serviceRegistry.getService( ConfigurationService.class );
|
||||
|
@ -128,7 +128,7 @@ public class EnversServiceImpl implements EnversService, Configurable, Stoppable
|
|||
|
||||
this.globalConfiguration = new GlobalConfiguration( this, properties );
|
||||
|
||||
final ReflectionManager reflectionManager = metadata.getBootstrapContext()
|
||||
final ReflectionManager reflectionManager = metadata.getMetadataBuildingOptions()
|
||||
.getReflectionManager();
|
||||
final RevisionInfoConfiguration revInfoCfg = new RevisionInfoConfiguration( globalConfiguration );
|
||||
final RevisionInfoConfigurationResult revInfoCfgResult = revInfoCfg.configure(
|
||||
|
|
|
@ -12,7 +12,7 @@ import java.util.Map;
|
|||
|
||||
import org.hibernate.MappingException;
|
||||
import org.hibernate.annotations.common.reflection.ReflectionManager;
|
||||
import org.hibernate.boot.spi.InFlightMetadataCollector;
|
||||
import org.hibernate.boot.spi.MetadataImplementor;
|
||||
import org.hibernate.envers.configuration.internal.metadata.AuditEntityNameRegister;
|
||||
import org.hibernate.envers.configuration.internal.metadata.AuditMetadataGenerator;
|
||||
import org.hibernate.envers.configuration.internal.metadata.EntityXmlMappingData;
|
||||
|
@ -34,7 +34,7 @@ import org.dom4j.Element;
|
|||
*/
|
||||
public class EntitiesConfigurator {
|
||||
public EntitiesConfigurations configure(
|
||||
InFlightMetadataCollector metadata,
|
||||
MetadataImplementor metadata,
|
||||
ServiceRegistry serviceRegistry,
|
||||
ReflectionManager reflectionManager,
|
||||
MappingCollector mappingCollector,
|
||||
|
|
|
@ -12,7 +12,7 @@ import java.util.Map;
|
|||
|
||||
import org.hibernate.MappingException;
|
||||
import org.hibernate.boot.registry.classloading.spi.ClassLoaderService;
|
||||
import org.hibernate.boot.spi.InFlightMetadataCollector;
|
||||
import org.hibernate.boot.spi.MetadataImplementor;
|
||||
import org.hibernate.envers.RelationTargetAuditMode;
|
||||
import org.hibernate.envers.configuration.internal.AuditEntitiesConfiguration;
|
||||
import org.hibernate.envers.configuration.internal.GlobalConfiguration;
|
||||
|
@ -68,7 +68,7 @@ public final class AuditMetadataGenerator {
|
|||
AuditMetadataGenerator.class.getName()
|
||||
);
|
||||
|
||||
private final InFlightMetadataCollector metadata;
|
||||
private final MetadataImplementor metadata;
|
||||
private final ServiceRegistry serviceRegistry;
|
||||
private final GlobalConfiguration globalCfg;
|
||||
private final AuditEntitiesConfiguration verEntCfg;
|
||||
|
@ -97,7 +97,7 @@ public final class AuditMetadataGenerator {
|
|||
private final Map<String, Map<Join, Element>> entitiesJoins;
|
||||
|
||||
public AuditMetadataGenerator(
|
||||
InFlightMetadataCollector metadata,
|
||||
MetadataImplementor metadata,
|
||||
ServiceRegistry serviceRegistry,
|
||||
GlobalConfiguration globalCfg,
|
||||
AuditEntitiesConfiguration verEntCfg,
|
||||
|
@ -125,7 +125,7 @@ public final class AuditMetadataGenerator {
|
|||
classLoaderService = serviceRegistry.getService( ClassLoaderService.class );
|
||||
}
|
||||
|
||||
public InFlightMetadataCollector getMetadata() {
|
||||
public MetadataImplementor getMetadata() {
|
||||
return metadata;
|
||||
}
|
||||
|
||||
|
|
|
@ -621,8 +621,9 @@ public final class CollectionMetadataGenerator {
|
|||
|
||||
final Element parentXmlMapping = xmlMapping.getParent();
|
||||
final ComponentAuditingData auditData = new ComponentAuditingData();
|
||||
final ReflectionManager reflectionManager = mainGenerator.getMetadata()
|
||||
.getBootstrapContext()
|
||||
final ReflectionManager reflectionManager = mainGenerator
|
||||
.getMetadata()
|
||||
.getMetadataBuildingOptions()
|
||||
.getReflectionManager();
|
||||
|
||||
new ComponentAuditedPropertiesReader(
|
||||
|
|
|
@ -39,7 +39,7 @@ public class BootstrapContextImpl implements BootstrapContext {
|
|||
StandardServiceRegistry serviceRegistry = new StandardServiceRegistryBuilder().build();
|
||||
MetadataBuildingOptions buildingOptions = new MetadataBuilderImpl.MetadataBuildingOptionsImpl( serviceRegistry );
|
||||
|
||||
delegate = new org.hibernate.boot.internal.BootstrapContextImpl( serviceRegistry, null, buildingOptions );
|
||||
delegate = new org.hibernate.boot.internal.BootstrapContextImpl( serviceRegistry, buildingOptions );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -7,13 +7,13 @@
|
|||
package org.hibernate.testing.boot;
|
||||
|
||||
import org.hibernate.boot.internal.BootstrapContextImpl;
|
||||
import org.hibernate.boot.internal.ClassmateContext;
|
||||
import org.hibernate.boot.internal.InFlightMetadataCollectorImpl;
|
||||
import org.hibernate.boot.internal.MetadataBuilderImpl;
|
||||
import org.hibernate.boot.model.naming.ObjectNameNormalizer;
|
||||
import org.hibernate.boot.registry.StandardServiceRegistry;
|
||||
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
|
||||
import org.hibernate.boot.spi.BootstrapContext;
|
||||
import org.hibernate.boot.spi.ClassLoaderAccess;
|
||||
import org.hibernate.boot.spi.InFlightMetadataCollector;
|
||||
import org.hibernate.boot.spi.MappingDefaults;
|
||||
import org.hibernate.boot.spi.MetadataBuildingContext;
|
||||
|
@ -37,11 +37,7 @@ public class MetadataBuildingContextTestingImpl implements MetadataBuildingConte
|
|||
|
||||
public MetadataBuildingContextTestingImpl(StandardServiceRegistry serviceRegistry) {
|
||||
buildingOptions = new MetadataBuilderImpl.MetadataBuildingOptionsImpl( serviceRegistry );
|
||||
bootstrapContext = new BootstrapContextImpl(
|
||||
serviceRegistry,
|
||||
new ClassmateContext(),
|
||||
buildingOptions
|
||||
);
|
||||
bootstrapContext = new BootstrapContextImpl( serviceRegistry, buildingOptions );
|
||||
mappingDefaults = new MetadataBuilderImpl.MappingDefaultsImpl( serviceRegistry );
|
||||
metadataCollector = new InFlightMetadataCollectorImpl( bootstrapContext,buildingOptions, new TypeResolver() );
|
||||
|
||||
|
@ -73,6 +69,11 @@ public class MetadataBuildingContextTestingImpl implements MetadataBuildingConte
|
|||
return metadataCollector;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ClassLoaderAccess getClassLoaderAccess() {
|
||||
return bootstrapContext.getClassLoaderAccess();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ObjectNameNormalizer getObjectNameNormalizer() {
|
||||
return objectNameNormalizer;
|
||||
|
|
Loading…
Reference in New Issue