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