HHH-16709 Use embeddable type's compare for embedded attribute mappings

This commit is contained in:
Marco Belladelli 2023-06-21 11:00:19 +02:00
parent ac4b674d5c
commit 69f3cfe837
2 changed files with 9 additions and 5 deletions

View File

@ -13,18 +13,14 @@ import java.util.function.Consumer;
import org.hibernate.engine.FetchStyle; import org.hibernate.engine.FetchStyle;
import org.hibernate.engine.FetchTiming; import org.hibernate.engine.FetchTiming;
import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.internal.util.collections.CollectionHelper; import org.hibernate.internal.util.collections.CollectionHelper;
import org.hibernate.metamodel.mapping.AttributeMapping; import org.hibernate.metamodel.mapping.AttributeMapping;
import org.hibernate.metamodel.mapping.AttributeMetadata; import org.hibernate.metamodel.mapping.AttributeMetadata;
import org.hibernate.metamodel.mapping.EmbeddableMappingType; import org.hibernate.metamodel.mapping.EmbeddableMappingType;
import org.hibernate.metamodel.mapping.EmbeddableValuedModelPart; import org.hibernate.metamodel.mapping.EmbeddableValuedModelPart;
import org.hibernate.metamodel.mapping.EntityMappingType;
import org.hibernate.metamodel.mapping.JdbcMapping; import org.hibernate.metamodel.mapping.JdbcMapping;
import org.hibernate.metamodel.mapping.ManagedMappingType; import org.hibernate.metamodel.mapping.ManagedMappingType;
import org.hibernate.metamodel.mapping.ModelPart;
import org.hibernate.metamodel.mapping.PropertyBasedMapping; import org.hibernate.metamodel.mapping.PropertyBasedMapping;
import org.hibernate.metamodel.mapping.SelectableConsumer;
import org.hibernate.metamodel.mapping.SelectableMapping; import org.hibernate.metamodel.mapping.SelectableMapping;
import org.hibernate.metamodel.mapping.SelectableMappings; import org.hibernate.metamodel.mapping.SelectableMappings;
import org.hibernate.metamodel.model.domain.NavigableRole; import org.hibernate.metamodel.model.domain.NavigableRole;
@ -407,4 +403,9 @@ public class EmbeddedAttributeMapping
} }
return producer.containsTableReference( tableExpression ); return producer.containsTableReference( tableExpression );
} }
@Override
public int compare(Object value1, Object value2) {
return embeddableMappingType.compare( value1, value2 );
}
} }

View File

@ -23,7 +23,6 @@ import org.hibernate.spi.NavigablePath;
import org.hibernate.sql.ast.spi.SqlSelection; import org.hibernate.sql.ast.spi.SqlSelection;
import org.hibernate.sql.ast.tree.from.TableGroup; import org.hibernate.sql.ast.tree.from.TableGroup;
import org.hibernate.sql.results.graph.DomainResultCreationState; import org.hibernate.sql.results.graph.DomainResultCreationState;
import org.hibernate.sql.results.graph.Fetchable;
/** /**
* Support for {@link jakarta.persistence.EmbeddedId} * Support for {@link jakarta.persistence.EmbeddedId}
@ -129,4 +128,8 @@ public class EmbeddedIdentifierMappingImpl
return results; return results;
} }
@Override
public int compare(Object value1, Object value2) {
return getEmbeddableTypeDescriptor().compare( value1, value2 );
}
} }