mirror of
https://github.com/hibernate/hibernate-orm
synced 2025-02-10 05:04:52 +00:00
HHH-16468 Don't create fetch for _identifierMapper anymore
This commit is contained in:
parent
9a12cae280
commit
d95b800d15
@ -689,7 +689,7 @@ private BiConsumer<Fetchable, Boolean> createFetchableBiConsumer(
|
||||
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 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 EmbeddedAttributeMapping(
|
||||
inverseModelPart.getFetchableName(),
|
||||
-1,
|
||||
inverseModelPart.getFetchableKey(),
|
||||
inverseModelPart instanceof AttributeMapping
|
||||
inverseModelPart.asAttributeMapping() != null
|
||||
? inverseModelPart.asAttributeMapping().getAttributeMetadata()
|
||||
: null,
|
||||
inverseModelPart.getMappedFetchOptions(),
|
||||
@ -162,6 +169,19 @@ public 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 EmbeddedAttributeMapping asEmbeddedAttributeMapping() {
|
||||
public boolean isEmbeddedAttributeMapping() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSelectable() {
|
||||
return selectable;
|
||||
}
|
||||
}
|
||||
|
@ -459,7 +459,7 @@ public ImmutableFetchList visitFetches(FetchParent fetchParent) {
|
||||
|
||||
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 Fetch visitIdentifierFetch(EntityResultGraphNode fetchParent) {
|
||||
}
|
||||
|
||||
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…
x
Reference in New Issue
Block a user