HHH-18703 Use natural order table numbers for subclass column closure

This commit is contained in:
Christian Beikov 2024-10-07 19:49:57 +02:00
parent 92cbbc5143
commit 556285b735
1 changed files with 6 additions and 5 deletions

View File

@ -127,7 +127,7 @@ public class JoinedSubclassEntityPersister extends AbstractEntityPersister {
// the closure of all columns used by the entire hierarchy including
// subclasses and superclasses of this class
private final int[] subclassColumnTableNumberClosure;
private final int[] subclassColumnNaturalOrderTableNumberClosure;
// private final int[] subclassFormulaTableNumberClosure;
private final String[] subclassColumnClosure;
@ -470,11 +470,12 @@ public class JoinedSubclassEntityPersister extends AbstractEntityPersister {
final String tableName = property.getValue().getTable().
getQualifiedName( creationContext.getSqlStringGenerationContext() );
final Integer tableNumber = getTableId( tableName, subclassTableNameClosure );
final Integer naturalTableNumber = getTableId( tableName, naturalOrderSubclassTableNameClosure );
propTableNumbers.add( tableNumber );
for ( Selectable selectable : property.getSelectables() ) {
if ( !selectable.isFormula() ) {
columnTableNumbers.add( tableNumber );
columnTableNumbers.add( naturalTableNumber );
Column column = (Column) selectable;
columns.add( column.getQuotedName( dialect ) );
}
@ -484,7 +485,7 @@ public class JoinedSubclassEntityPersister extends AbstractEntityPersister {
}
}
subclassColumnTableNumberClosure = toIntArray( columnTableNumbers );
subclassColumnNaturalOrderTableNumberClosure = toIntArray( columnTableNumbers );
subclassPropertyTableNumberClosure = toIntArray( propTableNumbers );
// subclassFormulaTableNumberClosure = ArrayHelper.toIntArray( formulaTableNumbers );
subclassColumnClosure = toStringArray( columns );
@ -1069,12 +1070,12 @@ public class JoinedSubclassEntityPersister extends AbstractEntityPersister {
&& subclassColumnClosure[i].endsWith( "\"" );
if ( quoted ) {
if ( subclassColumnClosure[i].equals( columnName ) ) {
return subclassColumnTableNumberClosure[i];
return subclassColumnNaturalOrderTableNumberClosure[i];
}
}
else {
if ( subclassColumnClosure[i].equalsIgnoreCase( columnName ) ) {
return subclassColumnTableNumberClosure[i];
return subclassColumnNaturalOrderTableNumberClosure[i];
}
}
}