Refactoring, removed InFlightEntityMappingType#finishMappingModelInitialization method
This commit is contained in:
parent
287808a914
commit
d5715e3fbc
|
@ -23,7 +23,6 @@ import org.hibernate.engine.spi.SharedSessionContractImplementor;
|
|||
import org.hibernate.internal.util.collections.ArrayHelper;
|
||||
import org.hibernate.mapping.Component;
|
||||
import org.hibernate.mapping.Property;
|
||||
import org.hibernate.mapping.ToOne;
|
||||
import org.hibernate.metamodel.mapping.internal.MappingModelCreationHelper;
|
||||
import org.hibernate.metamodel.mapping.internal.MappingModelCreationProcess;
|
||||
import org.hibernate.metamodel.mapping.internal.SingularAssociationAttributeMapping;
|
||||
|
@ -194,14 +193,6 @@ public class EmbeddableMappingType implements ManagedMappingType {
|
|||
compositeType.getCascadeStyle( attributeIndex ),
|
||||
creationProcess
|
||||
);
|
||||
MappingModelCreationHelper.interpretKeyDescriptor(
|
||||
singularAssociationAttributeMapping,
|
||||
bootPropertyDescriptor,
|
||||
(ToOne) bootPropertyDescriptor.getValue(),
|
||||
entityPersister,
|
||||
dialect,
|
||||
creationProcess
|
||||
);
|
||||
attributeMappings.put( bootPropertyDescriptor.getName(), singularAssociationAttributeMapping );
|
||||
// todo (6.0) : not sure it is always correct
|
||||
columnPosition++;
|
||||
|
|
|
@ -35,8 +35,4 @@ public interface InFlightEntityMappingType extends EntityMappingType {
|
|||
default void prepareMappingModel(MappingModelCreationProcess creationProcess) {
|
||||
// by default do nothing - support for legacy impls
|
||||
}
|
||||
|
||||
default void finishMappingModelInitialization(MappingModelCreationProcess creationProcess) {
|
||||
// by default do nothing
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1281,12 +1281,11 @@ public class MappingModelCreationHelper {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
public static SingularAssociationAttributeMapping buildSingularAssociationAttributeMapping(
|
||||
String attrName,
|
||||
int stateArrayPosition,
|
||||
Property bootProperty,
|
||||
ManagedMappingType declaringType,
|
||||
EntityPersister declaringType,
|
||||
EntityType attrType,
|
||||
PropertyAccess propertyAccess,
|
||||
CascadeStyle cascadeStyle,
|
||||
|
@ -1316,7 +1315,7 @@ public class MappingModelCreationHelper {
|
|||
|
||||
final FetchStrategy fetchStrategy = new FetchStrategy( fetchTiming, fetchStyle );
|
||||
|
||||
return new SingularAssociationAttributeMapping(
|
||||
final SingularAssociationAttributeMapping attributeMapping = new SingularAssociationAttributeMapping(
|
||||
attrName,
|
||||
stateArrayPosition,
|
||||
(ToOne) bootProperty.getValue(),
|
||||
|
@ -1326,6 +1325,25 @@ public class MappingModelCreationHelper {
|
|||
declaringType,
|
||||
propertyAccess
|
||||
);
|
||||
creationProcess.registerInitializationCallback(
|
||||
() -> {
|
||||
final Dialect dialect = creationProcess.getCreationContext()
|
||||
.getSessionFactory()
|
||||
.getJdbcServices()
|
||||
.getDialect();
|
||||
|
||||
MappingModelCreationHelper.interpretKeyDescriptor(
|
||||
attributeMapping,
|
||||
bootProperty,
|
||||
(ToOne) bootProperty.getValue(),
|
||||
declaringType,
|
||||
dialect,
|
||||
creationProcess
|
||||
);
|
||||
return true;
|
||||
}
|
||||
);
|
||||
return attributeMapping;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -66,12 +66,6 @@ public class MappingModelCreationProcess {
|
|||
entityPersister.prepareMappingModel( this );
|
||||
}
|
||||
|
||||
for ( EntityPersister entityPersister : entityPersisterMap.values() ) {
|
||||
currentlyProcessingRole = entityPersister.getEntityName();
|
||||
|
||||
entityPersister.finishMappingModelInitialization( this );
|
||||
}
|
||||
|
||||
while ( postInitCallbacks != null && ! postInitCallbacks.isEmpty() ) {
|
||||
// copy to avoid CCME
|
||||
final ArrayList<PostInitCallback> copy = new ArrayList<>( new ArrayList<>( postInitCallbacks ) );
|
||||
|
|
|
@ -124,7 +124,6 @@ import org.hibernate.mapping.RootClass;
|
|||
import org.hibernate.mapping.Selectable;
|
||||
import org.hibernate.mapping.Subclass;
|
||||
import org.hibernate.mapping.Table;
|
||||
import org.hibernate.mapping.ToOne;
|
||||
import org.hibernate.metadata.ClassMetadata;
|
||||
import org.hibernate.metamodel.RepresentationMode;
|
||||
import org.hibernate.metamodel.mapping.AttributeMapping;
|
||||
|
@ -5781,27 +5780,6 @@ public abstract class AbstractEntityPersister
|
|||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finishMappingModelInitialization(MappingModelCreationProcess creationProcess) {
|
||||
singularAssociationsToFinilize.forEach( (property, singularAssociationAttributeMapping) -> {
|
||||
final Dialect dialect = creationProcess.getCreationContext()
|
||||
.getSessionFactory()
|
||||
.getJdbcServices()
|
||||
.getDialect();
|
||||
|
||||
MappingModelCreationHelper.interpretKeyDescriptor(
|
||||
singularAssociationAttributeMapping,
|
||||
property,
|
||||
(ToOne) property.getValue(),
|
||||
this,
|
||||
dialect,
|
||||
creationProcess
|
||||
);
|
||||
} );
|
||||
|
||||
singularAssociationsToFinilize.clear();
|
||||
}
|
||||
|
||||
protected static SqmMultiTableMutationStrategy interpretSqmMultiTableStrategy(
|
||||
AbstractEntityPersister entityMappingDescriptor,
|
||||
MappingModelCreationProcess creationProcess) {
|
||||
|
@ -5969,8 +5947,6 @@ public abstract class AbstractEntityPersister
|
|||
throw new NotYetImplementedFor6Exception( AbstractEntityPersister.class );
|
||||
}
|
||||
|
||||
Map<Property,SingularAssociationAttributeMapping> singularAssociationsToFinilize = new HashMap<>( );
|
||||
|
||||
private AttributeMapping generateNonIdAttributeMapping(
|
||||
NonIdentifierAttribute tupleAttrDefinition,
|
||||
Property bootProperty,
|
||||
|
@ -6042,7 +6018,6 @@ public abstract class AbstractEntityPersister
|
|||
tupleAttrDefinition.getCascadeStyle(),
|
||||
creationProcess
|
||||
);
|
||||
singularAssociationsToFinilize.put( bootProperty,attributeMapping );
|
||||
return attributeMapping;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue