HHH-16353 Make it possible for Hibernate Reactive to override the creation of AttributeMapping and Fetch strategies

This commit is contained in:
Davide D'Alto 2023-03-22 16:09:46 +01:00 committed by Davide D'Alto
parent 837d1a32cb
commit d63ff31b59
10 changed files with 429 additions and 63 deletions

View File

@ -27,6 +27,11 @@ public abstract class AbstractAttributeMapping implements AttributeMapping {
this.declaringType = declaringType;
}
// For Hibernate Reactive
protected AbstractAttributeMapping(AbstractAttributeMapping original) {
this( original.name, original.fetchableIndex, original.declaringType );
}
@Override
public ManagedMappingType getDeclaringType() {
return declaringType;

View File

@ -23,6 +23,7 @@ import org.hibernate.metamodel.mapping.AssociationKey;
import org.hibernate.metamodel.mapping.EntityIdentifierMapping;
import org.hibernate.metamodel.mapping.EntityMappingType;
import org.hibernate.metamodel.mapping.ForeignKeyDescriptor;
import org.hibernate.metamodel.mapping.PluralAttributeMapping;
import org.hibernate.metamodel.model.domain.NavigableRole;
import org.hibernate.persister.collection.CollectionPersister;
import org.hibernate.persister.entity.PropertyMapping;
@ -41,6 +42,7 @@ import org.hibernate.sql.results.graph.DomainResult;
import org.hibernate.sql.results.graph.DomainResultCreationState;
import org.hibernate.sql.results.graph.FetchOptions;
import org.hibernate.sql.results.graph.FetchParent;
import org.hibernate.sql.results.graph.collection.internal.EagerCollectionFetch;
import org.hibernate.sql.results.graph.entity.EntityFetch;
import org.hibernate.sql.results.graph.entity.internal.EntityFetchJoinedImpl;
import org.hibernate.type.CompositeType;
@ -82,6 +84,16 @@ public abstract class AbstractEntityCollectionPart implements EntityCollectionPa
);
}
// For Hibernate Reactive
protected AbstractEntityCollectionPart(AbstractEntityCollectionPart original) {
this.navigableRole = original.navigableRole;
this.nature = original.nature;
this.collectionDescriptor = original.collectionDescriptor;
this.associatedEntityTypeDescriptor = original.associatedEntityTypeDescriptor;
this.notFoundAction = original.notFoundAction;
this.targetKeyPropertyNames = original.targetKeyPropertyNames;
}
@Override
public String toString() {
return "EntityCollectionPart(" + navigableRole.getFullPath() + ")@" + System.identityHashCode( this );
@ -193,7 +205,7 @@ public abstract class AbstractEntityCollectionPart implements EntityCollectionPa
final boolean added = creationState.registerVisitedAssociationKey( associationKey );
final TableGroup partTableGroup = resolveTableGroup( fetchablePath, creationState );
final EntityFetchJoinedImpl fetch = new EntityFetchJoinedImpl(
final EntityFetch fetch = buildEntityFetchJoined(
fetchParent,
this,
partTableGroup,
@ -208,6 +220,38 @@ public abstract class AbstractEntityCollectionPart implements EntityCollectionPa
return fetch;
}
// For Hibernate Reactive
protected EagerCollectionFetch buildEagerCollectionFetch(
NavigablePath fetchedPath,
PluralAttributeMapping fetchedAttribute,
TableGroup collectionTableGroup,
FetchParent fetchParent,
DomainResultCreationState creationState) {
return new EagerCollectionFetch(
fetchedPath,
fetchedAttribute,
collectionTableGroup,
fetchParent,
creationState
);
}
// For Hibernate Reactive
protected EntityFetch buildEntityFetchJoined(
FetchParent fetchParent,
AbstractEntityCollectionPart abstractEntityCollectionPart,
TableGroup partTableGroup,
NavigablePath fetchablePath,
DomainResultCreationState creationState) {
return new EntityFetchJoinedImpl(
fetchParent,
abstractEntityCollectionPart,
partTableGroup,
fetchablePath,
creationState
);
}
protected abstract AssociationKey resolveFetchAssociationKey();
private TableGroup resolveTableGroup(NavigablePath fetchablePath, DomainResultCreationState creationState) {

View File

@ -49,6 +49,12 @@ public abstract class AbstractSingularAttributeMapping
this.propertyAccess = propertyAccess;
}
// For Hibernate Reactive
protected AbstractSingularAttributeMapping( AbstractSingularAttributeMapping original ) {
super( original );
this.propertyAccess = original.propertyAccess;
}
@Override
public PropertyAccess getPropertyAccess() {
return propertyAccess;

View File

@ -57,6 +57,16 @@ public abstract class AbstractStateArrayContributorMapping
);
}
// For Hibernate Reactive
protected AbstractStateArrayContributorMapping(AbstractStateArrayContributorMapping original) {
super( original );
this.attributeMetadata = original.attributeMetadata;
this.fetchTiming = original.fetchTiming;
this.fetchStyle = original.fetchStyle;
this.stateArrayPosition = original.stateArrayPosition;
}
@Override
public int getStateArrayPosition() {
return stateArrayPosition;

View File

@ -12,6 +12,7 @@ import java.util.Iterator;
import java.util.List;
import java.util.SortedMap;
import java.util.SortedSet;
import java.util.function.Function;
import org.hibernate.FetchMode;
import org.hibernate.MappingException;
@ -431,6 +432,33 @@ public class MappingModelCreationHelper {
CascadeStyle cascadeStyle,
FetchMode fetchMode,
MappingModelCreationProcess creationProcess) {
return buildPluralAttributeMapping(
attrName,
stateArrayPosition,
fetchableIndex,
bootProperty,
declaringType,
propertyAccess,
cascadeStyle,
fetchMode,
creationProcess,
Function.identity()
);
}
@SuppressWarnings("rawtypes")
public static PluralAttributeMapping buildPluralAttributeMapping(
String attrName,
int stateArrayPosition,
int fetchableIndex,
Property bootProperty,
ManagedMappingType declaringType,
PropertyAccess propertyAccess,
CascadeStyle cascadeStyle,
FetchMode fetchMode,
MappingModelCreationProcess creationProcess,
// For Hibernate Reactive
Function<PluralAttributeMappingImpl, PluralAttributeMappingImpl> mappingConverter) {
final Collection bootValueMapping = (Collection) bootProperty.getValue();
@ -625,28 +653,33 @@ public class MappingModelCreationHelper {
sessionFactory
);
final PluralAttributeMappingImpl pluralAttributeMapping = new PluralAttributeMappingImpl(
attrName,
bootValueMapping,
propertyAccess,
attributeMetadata,
collectionMappingType,
stateArrayPosition,
fetchableIndex,
elementDescriptor,
indexDescriptor,
identifierDescriptor,
timing,
style,
cascadeStyle,
declaringType,
collectionDescriptor
);
final PluralAttributeMappingImpl pluralAttributeMapping = mappingConverter
.apply( new PluralAttributeMappingImpl(
attrName,
bootValueMapping,
propertyAccess,
attributeMetadata,
collectionMappingType,
stateArrayPosition,
fetchableIndex,
elementDescriptor,
indexDescriptor,
identifierDescriptor,
timing,
style,
cascadeStyle,
declaringType,
collectionDescriptor
) );
creationProcess.registerInitializationCallback(
"PluralAttributeMapping(" + bootValueMapping.getRole() + ")#finishInitialization",
() -> {
pluralAttributeMapping.finishInitialization( bootProperty, bootValueMapping, creationProcess );
pluralAttributeMapping.finishInitialization(
bootProperty,
bootValueMapping,
creationProcess
);
return true;
}
);
@ -1550,6 +1583,7 @@ public class MappingModelCreationHelper {
}
}
// For Hibernate Reactive
public static ToOneAttributeMapping buildSingularAssociationAttributeMapping(
String attrName,
NavigableRole navigableRole,
@ -1562,6 +1596,35 @@ public class MappingModelCreationHelper {
PropertyAccess propertyAccess,
CascadeStyle cascadeStyle,
MappingModelCreationProcess creationProcess) {
return buildSingularAssociationAttributeMapping(
attrName,
navigableRole,
stateArrayPosition,
fetchableIndex,
bootProperty,
declaringType,
declaringEntityPersister,
attrType,
propertyAccess,
cascadeStyle,
creationProcess,
Function.identity()
);
}
public static ToOneAttributeMapping buildSingularAssociationAttributeMapping(
String attrName,
NavigableRole navigableRole,
int stateArrayPosition,
int fetchableIndex,
Property bootProperty,
ManagedMappingType declaringType,
EntityPersister declaringEntityPersister,
EntityType attrType,
PropertyAccess propertyAccess,
CascadeStyle cascadeStyle,
MappingModelCreationProcess creationProcess,
Function<ToOneAttributeMapping, ToOneAttributeMapping> mappingConverter) {
if ( bootProperty.getValue() instanceof ToOne ) {
final ToOne value = (ToOne) bootProperty.getValue();
final EntityPersister entityPersister = creationProcess.getEntityPersister( value.getReferencedEntityName() );
@ -1614,7 +1677,7 @@ public class MappingModelCreationHelper {
fetchTiming = FetchOptionsHelper.determineFetchTiming( fetchStyle, type, lazy, role, sessionFactory );
}
final ToOneAttributeMapping attributeMapping = new ToOneAttributeMapping(
final ToOneAttributeMapping attributeMapping = mappingConverter.apply( new ToOneAttributeMapping(
attrName,
navigableRole,
stateArrayPosition,
@ -1627,7 +1690,7 @@ public class MappingModelCreationHelper {
declaringType,
declaringEntityPersister,
propertyAccess
);
) );
creationProcess.registerForeignKeyPostInitCallbacks(
"To-one key - " + navigableRole,

View File

@ -73,6 +73,12 @@ public class OneToManyCollectionPart extends AbstractEntityCollectionPart implem
}
}
protected OneToManyCollectionPart(OneToManyCollectionPart original) {
super( original );
this.mapKeyPropertyName = original.mapKeyPropertyName;
this.fetchAssociationKey = original.fetchAssociationKey;
}
@Override
public Cardinality getCardinality() {
return Cardinality.ONE_TO_MANY;

View File

@ -190,16 +190,49 @@ public class PluralAttributeMappingImpl
}
};
injectAttributeMapping( elementDescriptor, indexDescriptor, collectionDescriptor, this );
}
// For Hibernate Reactive
protected PluralAttributeMappingImpl(PluralAttributeMappingImpl original) {
super( original );
this.propertyAccess = original.propertyAccess;
this.attributeMetadata = original.attributeMetadata;
this.collectionMappingType = original.collectionMappingType;
this.stateArrayPosition = original.stateArrayPosition;
this.elementDescriptor = original.elementDescriptor;
this.indexDescriptor = original.indexDescriptor;
this.identifierDescriptor = original.identifierDescriptor;
this.fetchTiming = original.fetchTiming;
this.fetchStyle = original.fetchStyle;
this.collectionDescriptor = original.collectionDescriptor;
this.referencedPropertyName = original.referencedPropertyName;
this.mapKeyPropertyName = original.mapKeyPropertyName;
this.bidirectionalAttributeName = original.bidirectionalAttributeName;
this.sqlAliasStem = original.sqlAliasStem;
this.separateCollectionTable = original.separateCollectionTable;
this.indexMetadata = original.indexMetadata;
this.fkDescriptor = original.fkDescriptor;
this.orderByFragment = original.orderByFragment;
this.manyToManyOrderByFragment = original.manyToManyOrderByFragment;
injectAttributeMapping( elementDescriptor, indexDescriptor, collectionDescriptor, this );
}
private static void injectAttributeMapping(
CollectionPart elementDescriptor,
CollectionPart indexDescriptor,
CollectionPersister collectionDescriptor,
PluralAttributeMapping mapping) {
if ( collectionDescriptor instanceof Aware ) {
( (Aware) collectionDescriptor ).injectAttributeMapping( this );
( (Aware) collectionDescriptor ).injectAttributeMapping( mapping );
}
if ( elementDescriptor instanceof Aware ) {
( (Aware) elementDescriptor ).injectAttributeMapping( this );
( (Aware) elementDescriptor ).injectAttributeMapping( mapping );
}
if ( indexDescriptor instanceof Aware ) {
( (Aware) indexDescriptor ).injectAttributeMapping( this );
( (Aware) indexDescriptor ).injectAttributeMapping( mapping );
}
}
@ -405,7 +438,7 @@ public class PluralAttributeMappingImpl
sqlAstCreationState
);
return new EagerCollectionFetch(
return buildEagerCollectionFetch(
fetchablePath,
this,
collectionTableGroup,
@ -443,6 +476,40 @@ public class PluralAttributeMappingImpl
}
}
// For Hibernate Reactive
protected Fetch buildDelayedCollectionFetch(
NavigablePath fetchedPath,
PluralAttributeMapping fetchedAttribute,
FetchParent fetchParent,
DomainResult<?> collectionKeyResult) {
return new DelayedCollectionFetch( fetchedPath, fetchedAttribute, fetchParent, collectionKeyResult );
}
// For Hibernate Reactive
protected Fetch buildSelectEagerCollectionFetch(
NavigablePath fetchedPath,
PluralAttributeMapping fetchedAttribute,
DomainResult<?> collectionKeyDomainResult,
FetchParent fetchParent) {
return new SelectEagerCollectionFetch( fetchedPath, fetchedAttribute, collectionKeyDomainResult, fetchParent );
}
// For Hibernate Reactive
protected Fetch buildEagerCollectionFetch(
NavigablePath fetchedPath,
PluralAttributeMapping fetchedAttribute,
TableGroup collectionTableGroup,
FetchParent fetchParent,
DomainResultCreationState creationState) {
return new EagerCollectionFetch(
fetchedPath,
fetchedAttribute,
collectionTableGroup,
fetchParent,
creationState
);
}
@Override
public Fetch resolveCircularFetch(
NavigablePath fetchablePath,
@ -481,7 +548,7 @@ public class PluralAttributeMappingImpl
else {
collectionKeyDomainResult = null;
}
return new SelectEagerCollectionFetch( fetchablePath, this, collectionKeyDomainResult, fetchParent );
return buildSelectEagerCollectionFetch( fetchablePath, this, collectionKeyDomainResult, fetchParent );
}
private TableGroup resolveCollectionTableGroup(
@ -531,7 +598,7 @@ public class PluralAttributeMappingImpl
creationState
);
}
return new DelayedCollectionFetch(
return buildDelayedCollectionFetch(
fetchablePath,
this,
fetchParent,

View File

@ -157,32 +157,29 @@ public class ToOneAttributeMapping
private String identifyingColumnsTableExpression;
private boolean canUseParentTableGroup;
protected ToOneAttributeMapping(ToOneAttributeMapping delegate) {
super(
delegate.getAttributeName(),
delegate.getStateArrayPosition(),
delegate.getFetchableKey(),
delegate.getAttributeMetadata(),
delegate.getMappedFetchOptions(),
delegate.getDeclaringType(),
delegate.getPropertyAccess()
);
navigableRole = delegate.navigableRole;
isInternalLoadNullable = delegate.isInternalLoadNullable;
notFoundAction = delegate.notFoundAction;
unwrapProxy = delegate.unwrapProxy;
isOptional = delegate.isOptional;
entityMappingType = delegate.entityMappingType;
referencedPropertyName = delegate.referencedPropertyName;
targetKeyPropertyName = delegate.targetKeyPropertyName;
cardinality = delegate.cardinality;
bidirectionalAttributePath = delegate.bidirectionalAttributePath;
declaringTableGroupProducer = delegate.declaringTableGroupProducer;
isKeyTableNullable = delegate.isKeyTableNullable;
sqlAliasStem = delegate.sqlAliasStem;
targetKeyPropertyNames = delegate.targetKeyPropertyNames;
isNullable = delegate.isNullable;
foreignKeyDescriptor = delegate.foreignKeyDescriptor;
// For Hibernate Reactive
protected ToOneAttributeMapping(ToOneAttributeMapping original) {
super( original );
navigableRole = original.navigableRole;
isInternalLoadNullable = original.isInternalLoadNullable;
notFoundAction = original.notFoundAction;
unwrapProxy = original.unwrapProxy;
isOptional = original.isOptional;
entityMappingType = original.entityMappingType;
referencedPropertyName = original.referencedPropertyName;
targetKeyPropertyName = original.targetKeyPropertyName;
cardinality = original.cardinality;
bidirectionalAttributePath = original.bidirectionalAttributePath;
declaringTableGroupProducer = original.declaringTableGroupProducer;
isKeyTableNullable = original.isKeyTableNullable;
sqlAliasStem = original.sqlAliasStem;
targetKeyPropertyNames = original.targetKeyPropertyNames;
isNullable = original.isNullable;
foreignKeyDescriptor = original.foreignKeyDescriptor;
sideNature = original.sideNature;
identifyingColumnsTableExpression = original.identifyingColumnsTableExpression;
canUseParentTableGroup = original.canUseParentTableGroup;
}
public ToOneAttributeMapping(
@ -1186,7 +1183,7 @@ public class ToOneAttributeMapping
final FromClauseAccess fromClauseAccess = creationState.getSqlAstCreationState().getFromClauseAccess();
final TableGroup tableGroup = fromClauseAccess.getTableGroup( referencedNavigablePath );
fromClauseAccess.registerTableGroup( fetchablePath, tableGroup );
return new EntityFetchJoinedImpl(
return buildEntityFetchJoined(
fetchParent,
this,
tableGroup,
@ -1216,7 +1213,7 @@ public class ToOneAttributeMapping
creationState
);
if ( fetchTiming == FetchTiming.IMMEDIATE ) {
return new EntityFetchSelectImpl(
return buildEntityFetchSelect(
fetchParent,
this,
fetchablePath,
@ -1226,7 +1223,7 @@ public class ToOneAttributeMapping
);
}
return new EntityDelayedFetchImpl(
return buildEntityDelayedFetch(
fetchParent,
this,
fetchablePath,
@ -1236,6 +1233,52 @@ public class ToOneAttributeMapping
}
}
// For Hibernate Reactive
protected EntityFetch buildEntityDelayedFetch(
FetchParent fetchParent,
ToOneAttributeMapping fetchedAttribute,
NavigablePath navigablePath,
DomainResult<?> keyResult,
boolean selectByUniqueKey) {
return new EntityDelayedFetchImpl( fetchParent, fetchedAttribute, navigablePath, keyResult, selectByUniqueKey );
}
// For Hibernate Reactive
protected EntityFetch buildEntityFetchSelect(
FetchParent fetchParent,
ToOneAttributeMapping fetchedAttribute,
NavigablePath navigablePath,
DomainResult<?> keyResult,
boolean selectByUniqueKey,
@SuppressWarnings("unused") DomainResultCreationState creationState) {
return new EntityFetchSelectImpl(
fetchParent,
fetchedAttribute,
navigablePath,
keyResult,
selectByUniqueKey,
creationState
);
}
// For Hibernate Reactive
protected EntityFetch buildEntityFetchJoined(
FetchParent fetchParent,
ToOneAttributeMapping toOneMapping,
TableGroup tableGroup,
DomainResult<?> keyResult,
NavigablePath navigablePath,
DomainResultCreationState creationState) {
return new EntityFetchJoinedImpl(
fetchParent,
toOneMapping,
tableGroup,
keyResult,
navigablePath,
creationState
);
}
private NavigablePath getReferencedNavigablePath(
DomainResultCreationState creationState,
NavigablePath parentNavigablePath) {
@ -1385,7 +1428,7 @@ public class ToOneAttributeMapping
);
}
return new EntityFetchJoinedImpl(
return buildEntityFetchJoined(
fetchParent,
this,
tableGroup,
@ -1443,7 +1486,7 @@ public class ToOneAttributeMapping
// Consider all associations annotated with @NotFound as EAGER
if ( fetchTiming == FetchTiming.IMMEDIATE || hasNotFoundAction() ) {
return new EntityFetchSelectImpl(
return buildEntityFetchSelect(
fetchParent,
this,
fetchablePath,
@ -1453,7 +1496,7 @@ public class ToOneAttributeMapping
);
}
return new EntityDelayedFetchImpl(
return buildEntityDelayedFetch(
fetchParent,
this,
fetchablePath,

View File

@ -5420,7 +5420,7 @@ public abstract class AbstractEntityPersister
dependantValue = ( (DependantValue) bootProperty.getValue() );
}
return MappingModelCreationHelper.buildEmbeddedAttributeMapping(
return buildEmbeddedAttributeMapping(
attrName,
stateArrayPosition,
fetchableIndex,
@ -5437,7 +5437,7 @@ public abstract class AbstractEntityPersister
);
}
else if ( attrType instanceof CollectionType ) {
return MappingModelCreationHelper.buildPluralAttributeMapping(
return buildPluralAttributeMapping(
attrName,
stateArrayPosition,
fetchableIndex,
@ -5450,7 +5450,7 @@ public abstract class AbstractEntityPersister
);
}
else if ( attrType instanceof EntityType ) {
return MappingModelCreationHelper.buildSingularAssociationAttributeMapping(
return buildSingularAssociationAttributeMapping(
attrName,
getNavigableRole().append( attrName ),
stateArrayPosition,
@ -5470,6 +5470,90 @@ public abstract class AbstractEntityPersister
return null;
}
// For Hibernate Reactive
protected EmbeddedAttributeMapping buildEmbeddedAttributeMapping(
String attrName,
int stateArrayPosition,
int fetchableIndex,
Property bootProperty,
DependantValue dependantValue,
int dependantColumnIndex,
ManagedMappingType declaringType,
CompositeType attrType,
String tableExpression,
String[] rootTableKeyColumnNames,
PropertyAccess propertyAccess,
CascadeStyle cascadeStyle,
MappingModelCreationProcess creationProcess) {
return MappingModelCreationHelper.buildEmbeddedAttributeMapping(
attrName,
stateArrayPosition,
fetchableIndex,
bootProperty,
dependantValue,
dependantColumnIndex,
declaringType,
attrType,
tableExpression,
rootTableKeyColumnNames,
propertyAccess,
cascadeStyle,
creationProcess
);
}
// For Hibernate Reactive
protected AttributeMapping buildSingularAssociationAttributeMapping(
String attrName,
NavigableRole navigableRole,
int stateArrayPosition,
int fetchableIndex,
Property bootProperty,
ManagedMappingType declaringType,
EntityPersister declaringEntityPersister,
EntityType attrType,
PropertyAccess propertyAccess,
CascadeStyle cascadeStyle,
MappingModelCreationProcess creationProcess) {
return MappingModelCreationHelper.buildSingularAssociationAttributeMapping(
attrName,
navigableRole,
stateArrayPosition,
fetchableIndex,
bootProperty,
declaringType,
declaringEntityPersister,
attrType,
propertyAccess,
cascadeStyle,
creationProcess
);
}
// For Hibernate Reactive
protected AttributeMapping buildPluralAttributeMapping(
String attrName,
int stateArrayPosition,
int fetchableIndex,
Property bootProperty,
ManagedMappingType declaringType,
PropertyAccess propertyAccess,
CascadeStyle cascadeStyle,
FetchMode fetchMode,
MappingModelCreationProcess creationProcess) {
return MappingModelCreationHelper.buildPluralAttributeMapping(
attrName,
stateArrayPosition,
fetchableIndex,
bootProperty,
declaringType,
propertyAccess,
cascadeStyle,
fetchMode,
creationProcess
);
}
@Override
public JavaType<?> getMappedJavaType() {
return javaType;

View File

@ -6,6 +6,7 @@
*/
package org.hibernate.sql.results.graph.entity.internal;
import org.hibernate.LockMode;
import org.hibernate.annotations.NotFoundAction;
import org.hibernate.engine.FetchTiming;
import org.hibernate.metamodel.mapping.internal.EntityCollectionPart;
@ -15,10 +16,14 @@ import org.hibernate.sql.ast.tree.from.TableGroup;
import org.hibernate.sql.results.graph.AssemblerCreationState;
import org.hibernate.sql.results.graph.DomainResult;
import org.hibernate.sql.results.graph.DomainResultCreationState;
import org.hibernate.sql.results.graph.Fetch;
import org.hibernate.sql.results.graph.FetchParent;
import org.hibernate.sql.results.graph.FetchParentAccess;
import org.hibernate.sql.results.graph.Initializer;
import org.hibernate.sql.results.graph.entity.AbstractNonLazyEntityFetch;
import org.hibernate.sql.results.graph.entity.EntityInitializer;
import org.hibernate.sql.results.graph.entity.EntityResultGraphNode;
import org.hibernate.sql.results.graph.entity.EntityValuedFetchable;
/**
* @author Andrea Boriero
@ -74,6 +79,15 @@ public class EntityFetchJoinedImpl extends AbstractNonLazyEntityFetch {
this.entityResult.afterInitialize( this, creationState );
}
// For Hibernate Reactive
protected EntityFetchJoinedImpl(EntityFetchJoinedImpl original ) {
super( original.getFetchParent(), original.getReferencedModePart(), original.getNavigablePath() );
this.entityResult = original.entityResult;
this.keyResult = original.keyResult;
this.notFoundAction = original.notFoundAction;
this.sourceAlias = original.sourceAlias;
}
@Override
protected EntityInitializer getEntityInitializer(
FetchParentAccess parentAccess,
@ -81,7 +95,7 @@ public class EntityFetchJoinedImpl extends AbstractNonLazyEntityFetch {
return creationState.resolveInitializer(
getNavigablePath(),
getReferencedModePart(),
() -> new EntityJoinedFetchInitializer(
() -> buildEntityJoinedFetchInitializer(
entityResult,
getReferencedModePart(),
getNavigablePath(),
@ -95,6 +109,30 @@ public class EntityFetchJoinedImpl extends AbstractNonLazyEntityFetch {
).asEntityInitializer();
}
// For Hibernate Reactive
protected Initializer buildEntityJoinedFetchInitializer(
EntityResultGraphNode resultDescriptor,
EntityValuedFetchable referencedFetchable,
NavigablePath navigablePath,
LockMode lockMode,
NotFoundAction notFoundAction,
DomainResult<?> keyResult,
Fetch identifierFetch,
Fetch discriminatorFetch,
AssemblerCreationState creationState) {
return new EntityJoinedFetchInitializer(
resultDescriptor,
referencedFetchable,
navigablePath,
lockMode,
notFoundAction,
keyResult,
identifierFetch,
discriminatorFetch,
creationState
);
}
@Override
public FetchTiming getTiming() {
return FetchTiming.IMMEDIATE;