From a12a108f59f556c2a0b840a18c9a2f354455d7bc Mon Sep 17 00:00:00 2001 From: Steve Ebersole Date: Thu, 15 Dec 2022 18:59:09 -0600 Subject: [PATCH] HHH-15884 - Clean-up EntityDiscriminatorMapping for API --- .../metamodel/mapping/EntityDiscriminatorMapping.java | 2 +- .../internal/CaseStatementDiscriminatorMappingImpl.java | 2 +- .../internal/ExplicitColumnDiscriminatorMappingImpl.java | 2 +- .../org/hibernate/query/sqm/sql/BaseSqmToSqlAstConverter.java | 2 +- .../main/java/org/hibernate/sql/ast/tree/cte/CteTable.java | 2 +- .../hibernate/orm/test/mapping/MappingModelAccessTests.java | 4 ++-- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/EntityDiscriminatorMapping.java b/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/EntityDiscriminatorMapping.java index fb5951cf79..7f746a3926 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/EntityDiscriminatorMapping.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/EntityDiscriminatorMapping.java @@ -49,7 +49,7 @@ public interface EntityDiscriminatorMapping extends VirtualModelPart, BasicValue /** * Is the discriminator defined by a physical column? */ - boolean isPhysical(); + boolean hasPhysicalColumn(); @Override default int getFetchableKey() { diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/CaseStatementDiscriminatorMappingImpl.java b/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/CaseStatementDiscriminatorMappingImpl.java index cd411f013c..af13be0674 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/CaseStatementDiscriminatorMappingImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/CaseStatementDiscriminatorMappingImpl.java @@ -75,7 +75,7 @@ public class CaseStatementDiscriminatorMappingImpl extends AbstractDiscriminator } @Override - public boolean isPhysical() { + public boolean hasPhysicalColumn() { return false; } diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/ExplicitColumnDiscriminatorMappingImpl.java b/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/ExplicitColumnDiscriminatorMappingImpl.java index 68ba3347d5..2e8f2eeba7 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/ExplicitColumnDiscriminatorMappingImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/ExplicitColumnDiscriminatorMappingImpl.java @@ -133,7 +133,7 @@ public class ExplicitColumnDiscriminatorMappingImpl extends AbstractDiscriminato } @Override - public boolean isPhysical() { + public boolean hasPhysicalColumn() { return isPhysical; } } diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/sql/BaseSqmToSqlAstConverter.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/sql/BaseSqmToSqlAstConverter.java index 349cf6850c..12b6f82557 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/sql/BaseSqmToSqlAstConverter.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/sql/BaseSqmToSqlAstConverter.java @@ -1337,7 +1337,7 @@ public abstract class BaseSqmToSqlAstConverter extends Base targetColumnReferenceConsumer.accept( versionPath, targetColumnReferences ); versionExpression = new VersionTypeSeedParameterSpecification( entityDescriptor.getVersionMapping() ); } - if ( discriminatorMapping != null && discriminatorMapping.isPhysical() ) { + if ( discriminatorMapping != null && discriminatorMapping.hasPhysicalColumn() ) { final BasicValuedPathInterpretation discriminatorPath = new BasicValuedPathInterpretation<>( new ColumnReference( rootTableGroup.resolveTableReference( discriminatorMapping.getContainingTableExpression() ), diff --git a/hibernate-core/src/main/java/org/hibernate/sql/ast/tree/cte/CteTable.java b/hibernate-core/src/main/java/org/hibernate/sql/ast/tree/cte/CteTable.java index df410d55fc..a213df347f 100644 --- a/hibernate-core/src/main/java/org/hibernate/sql/ast/tree/cte/CteTable.java +++ b/hibernate-core/src/main/java/org/hibernate/sql/ast/tree/cte/CteTable.java @@ -97,7 +97,7 @@ public class CteTable { forEachCteColumn( idName, identifierMapping, columns::add ); final EntityDiscriminatorMapping discriminatorMapping = entityDescriptor.getDiscriminatorMapping(); - if ( discriminatorMapping != null && discriminatorMapping.isPhysical() && !discriminatorMapping.isFormula() ) { + if ( discriminatorMapping != null && discriminatorMapping.hasPhysicalColumn() && !discriminatorMapping.isFormula() ) { forEachCteColumn( "class", discriminatorMapping, columns::add ); } diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/MappingModelAccessTests.java b/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/MappingModelAccessTests.java index 8afc08cd33..671401d494 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/MappingModelAccessTests.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/mapping/MappingModelAccessTests.java @@ -83,7 +83,7 @@ public class MappingModelAccessTests { .isSameAs( cardPaymentMapping.getDiscriminatorMapping() ) .isSameAs( cashPaymentMapping.getDiscriminatorMapping() ); - assertThat( discriminatorMapping.isPhysical() ).isFalse(); + assertThat( discriminatorMapping.hasPhysicalColumn() ).isFalse(); assertThat( discriminatorMapping.isVirtual() ).isTrue(); assertThat( discriminatorMapping.getJavaType().getJavaTypeClass() ).isEqualTo( Class.class ); assertThat( discriminatorMapping.getJdbcMapping().getJavaTypeDescriptor().getJavaTypeClass() ).isEqualTo( Class.class ); @@ -113,7 +113,7 @@ public class MappingModelAccessTests { .isSameAs( domesticVendorMapping.getDiscriminatorMapping() ) .isSameAs( foreignVendorMapping.getDiscriminatorMapping() ); - assertThat( discriminatorMapping.isPhysical() ).isTrue(); + assertThat( discriminatorMapping.hasPhysicalColumn() ).isTrue(); assertThat( discriminatorMapping.isVirtual() ).isTrue(); assertThat( discriminatorMapping.getJavaType().getJavaTypeClass() ).isEqualTo( Class.class ); assertThat( discriminatorMapping.getJdbcMapping().getJavaTypeDescriptor().getJavaTypeClass() ).isEqualTo( Class.class );