HHH-15884 - Clean-up EntityDiscriminatorMapping for API

This commit is contained in:
Steve Ebersole 2022-12-15 18:59:09 -06:00
parent ed4af59882
commit a12a108f59
6 changed files with 7 additions and 7 deletions

View File

@ -49,7 +49,7 @@ public interface EntityDiscriminatorMapping extends VirtualModelPart, BasicValue
/** /**
* Is the discriminator defined by a physical column? * Is the discriminator defined by a physical column?
*/ */
boolean isPhysical(); boolean hasPhysicalColumn();
@Override @Override
default int getFetchableKey() { default int getFetchableKey() {

View File

@ -75,7 +75,7 @@ public class CaseStatementDiscriminatorMappingImpl extends AbstractDiscriminator
} }
@Override @Override
public boolean isPhysical() { public boolean hasPhysicalColumn() {
return false; return false;
} }

View File

@ -133,7 +133,7 @@ public class ExplicitColumnDiscriminatorMappingImpl extends AbstractDiscriminato
} }
@Override @Override
public boolean isPhysical() { public boolean hasPhysicalColumn() {
return isPhysical; return isPhysical;
} }
} }

View File

@ -1337,7 +1337,7 @@ public abstract class BaseSqmToSqlAstConverter<T extends Statement> extends Base
targetColumnReferenceConsumer.accept( versionPath, targetColumnReferences ); targetColumnReferenceConsumer.accept( versionPath, targetColumnReferences );
versionExpression = new VersionTypeSeedParameterSpecification( entityDescriptor.getVersionMapping() ); versionExpression = new VersionTypeSeedParameterSpecification( entityDescriptor.getVersionMapping() );
} }
if ( discriminatorMapping != null && discriminatorMapping.isPhysical() ) { if ( discriminatorMapping != null && discriminatorMapping.hasPhysicalColumn() ) {
final BasicValuedPathInterpretation<?> discriminatorPath = new BasicValuedPathInterpretation<>( final BasicValuedPathInterpretation<?> discriminatorPath = new BasicValuedPathInterpretation<>(
new ColumnReference( new ColumnReference(
rootTableGroup.resolveTableReference( discriminatorMapping.getContainingTableExpression() ), rootTableGroup.resolveTableReference( discriminatorMapping.getContainingTableExpression() ),

View File

@ -97,7 +97,7 @@ public class CteTable {
forEachCteColumn( idName, identifierMapping, columns::add ); forEachCteColumn( idName, identifierMapping, columns::add );
final EntityDiscriminatorMapping discriminatorMapping = entityDescriptor.getDiscriminatorMapping(); final EntityDiscriminatorMapping discriminatorMapping = entityDescriptor.getDiscriminatorMapping();
if ( discriminatorMapping != null && discriminatorMapping.isPhysical() && !discriminatorMapping.isFormula() ) { if ( discriminatorMapping != null && discriminatorMapping.hasPhysicalColumn() && !discriminatorMapping.isFormula() ) {
forEachCteColumn( "class", discriminatorMapping, columns::add ); forEachCteColumn( "class", discriminatorMapping, columns::add );
} }

View File

@ -83,7 +83,7 @@ public class MappingModelAccessTests {
.isSameAs( cardPaymentMapping.getDiscriminatorMapping() ) .isSameAs( cardPaymentMapping.getDiscriminatorMapping() )
.isSameAs( cashPaymentMapping.getDiscriminatorMapping() ); .isSameAs( cashPaymentMapping.getDiscriminatorMapping() );
assertThat( discriminatorMapping.isPhysical() ).isFalse(); assertThat( discriminatorMapping.hasPhysicalColumn() ).isFalse();
assertThat( discriminatorMapping.isVirtual() ).isTrue(); assertThat( discriminatorMapping.isVirtual() ).isTrue();
assertThat( discriminatorMapping.getJavaType().getJavaTypeClass() ).isEqualTo( Class.class ); assertThat( discriminatorMapping.getJavaType().getJavaTypeClass() ).isEqualTo( Class.class );
assertThat( discriminatorMapping.getJdbcMapping().getJavaTypeDescriptor().getJavaTypeClass() ).isEqualTo( Class.class ); assertThat( discriminatorMapping.getJdbcMapping().getJavaTypeDescriptor().getJavaTypeClass() ).isEqualTo( Class.class );
@ -113,7 +113,7 @@ public class MappingModelAccessTests {
.isSameAs( domesticVendorMapping.getDiscriminatorMapping() ) .isSameAs( domesticVendorMapping.getDiscriminatorMapping() )
.isSameAs( foreignVendorMapping.getDiscriminatorMapping() ); .isSameAs( foreignVendorMapping.getDiscriminatorMapping() );
assertThat( discriminatorMapping.isPhysical() ).isTrue(); assertThat( discriminatorMapping.hasPhysicalColumn() ).isTrue();
assertThat( discriminatorMapping.isVirtual() ).isTrue(); assertThat( discriminatorMapping.isVirtual() ).isTrue();
assertThat( discriminatorMapping.getJavaType().getJavaTypeClass() ).isEqualTo( Class.class ); assertThat( discriminatorMapping.getJavaType().getJavaTypeClass() ).isEqualTo( Class.class );
assertThat( discriminatorMapping.getJdbcMapping().getJavaTypeDescriptor().getJavaTypeClass() ).isEqualTo( Class.class ); assertThat( discriminatorMapping.getJdbcMapping().getJavaTypeDescriptor().getJavaTypeClass() ).isEqualTo( Class.class );