HHH-16468 Don't create fetch for _identifierMapper anymore
This commit is contained in:
parent
9a12cae280
commit
d95b800d15
|
@ -689,7 +689,7 @@ public class LoaderSelectBuilder {
|
|||
LoaderSqlAstCreationState creationState,
|
||||
ImmutableFetchList.Builder fetches) {
|
||||
return (fetchable, isKeyFetchable) -> {
|
||||
if ( !fetchable.isSelectable() || fetchable.getPartName().equals( NavigablePath.IDENTIFIER_MAPPER_PROPERTY ) ) {
|
||||
if ( !fetchable.isSelectable() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -68,6 +68,7 @@ public class EmbeddedAttributeMapping
|
|||
private final String tableExpression;
|
||||
private final EmbeddableMappingType embeddableMappingType;
|
||||
private final PropertyAccess parentInjectionAttributePropertyAccess;
|
||||
private final boolean selectable;
|
||||
|
||||
public EmbeddedAttributeMapping(
|
||||
String name,
|
||||
|
@ -128,6 +129,12 @@ public class EmbeddedAttributeMapping
|
|||
|
||||
this.embeddableMappingType = embeddableMappingType;
|
||||
|
||||
if ( getAttributeName().equals( NavigablePath.IDENTIFIER_MAPPER_PROPERTY ) ) {
|
||||
selectable = false;
|
||||
}
|
||||
else {
|
||||
selectable = attributeMetadata.isSelectable();
|
||||
}
|
||||
}
|
||||
|
||||
// Constructor is only used for creating the inverse attribute mapping
|
||||
|
@ -142,7 +149,7 @@ public class EmbeddedAttributeMapping
|
|||
inverseModelPart.getFetchableName(),
|
||||
-1,
|
||||
inverseModelPart.getFetchableKey(),
|
||||
inverseModelPart instanceof AttributeMapping
|
||||
inverseModelPart.asAttributeMapping() != null
|
||||
? inverseModelPart.asAttributeMapping().getAttributeMetadata()
|
||||
: null,
|
||||
inverseModelPart.getMappedFetchOptions(),
|
||||
|
@ -162,6 +169,19 @@ public class EmbeddedAttributeMapping
|
|||
creationProcess
|
||||
);
|
||||
this.parentInjectionAttributePropertyAccess = null;
|
||||
|
||||
if ( getAttributeName().equals( NavigablePath.IDENTIFIER_MAPPER_PROPERTY ) ) {
|
||||
selectable = false;
|
||||
}
|
||||
else {
|
||||
AttributeMapping attributeMapping = inverseModelPart.asAttributeMapping();
|
||||
if ( attributeMapping != null ) {
|
||||
selectable = attributeMapping.isSelectable();
|
||||
}
|
||||
else {
|
||||
selectable = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -369,4 +389,9 @@ public class EmbeddedAttributeMapping
|
|||
public boolean isEmbeddedAttributeMapping() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSelectable() {
|
||||
return selectable;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -459,7 +459,7 @@ public class DomainResultCreationStateImpl
|
|||
|
||||
private Consumer<Fetchable> createFetchableConsumer(FetchParent fetchParent, ImmutableFetchList.Builder fetches) {
|
||||
return fetchable -> {
|
||||
if ( !fetchable.isSelectable() || fetchable.getPartName().equals( NavigablePath.IDENTIFIER_MAPPER_PROPERTY ) ) {
|
||||
if ( !fetchable.isSelectable() ) {
|
||||
return;
|
||||
}
|
||||
final String fetchableName = fetchable.getFetchableName();
|
||||
|
|
|
@ -7144,7 +7144,7 @@ public abstract class BaseSqmToSqlAstConverter<T extends Statement> extends Base
|
|||
}
|
||||
|
||||
private Fetch createFetch(FetchParent fetchParent, Fetchable fetchable, Boolean isKeyFetchable) {
|
||||
if ( !fetchable.isSelectable() || fetchable.getPartName().equals( NavigablePath.IDENTIFIER_MAPPER_PROPERTY ) ) {
|
||||
if ( !fetchable.isSelectable() ) {
|
||||
return null;
|
||||
}
|
||||
final NavigablePath resolvedNavigablePath = fetchParent.resolveNavigablePath( fetchable );
|
||||
|
|
Loading…
Reference in New Issue