HHH-18703 Use natural order table numbers for subclass column closure
This commit is contained in:
parent
176b6647f7
commit
89554833b0
|
@ -121,7 +121,7 @@ public class JoinedSubclassEntityPersister extends AbstractEntityPersister {
|
||||||
|
|
||||||
// the closure of all columns used by the entire hierarchy including
|
// the closure of all columns used by the entire hierarchy including
|
||||||
// subclasses and superclasses of this class
|
// subclasses and superclasses of this class
|
||||||
private final int[] subclassColumnTableNumberClosure;
|
private final int[] subclassColumnNaturalOrderTableNumberClosure;
|
||||||
private final String[] subclassColumnClosure;
|
private final String[] subclassColumnClosure;
|
||||||
|
|
||||||
private final boolean[] isNullableSubclassTable;
|
private final boolean[] isNullableSubclassTable;
|
||||||
|
@ -432,18 +432,19 @@ public class JoinedSubclassEntityPersister extends AbstractEntityPersister {
|
||||||
final String tableName = property.getValue().getTable().
|
final String tableName = property.getValue().getTable().
|
||||||
getQualifiedName( creationContext.getSqlStringGenerationContext() );
|
getQualifiedName( creationContext.getSqlStringGenerationContext() );
|
||||||
final Integer tableNumber = getTableId( tableName, subclassTableNameClosure );
|
final Integer tableNumber = getTableId( tableName, subclassTableNameClosure );
|
||||||
|
final Integer naturalTableNumber = getTableId( tableName, naturalOrderSubclassTableNameClosure );
|
||||||
propTableNumbers.add( tableNumber );
|
propTableNumbers.add( tableNumber );
|
||||||
|
|
||||||
for ( Selectable selectable : property.getSelectables() ) {
|
for ( Selectable selectable : property.getSelectables() ) {
|
||||||
if ( !selectable.isFormula() ) {
|
if ( !selectable.isFormula() ) {
|
||||||
columnTableNumbers.add( tableNumber );
|
columnTableNumbers.add( naturalTableNumber );
|
||||||
Column column = (Column) selectable;
|
Column column = (Column) selectable;
|
||||||
columns.add( column.getQuotedName( dialect ) );
|
columns.add( column.getQuotedName( dialect ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
subclassColumnTableNumberClosure = toIntArray( columnTableNumbers );
|
subclassColumnNaturalOrderTableNumberClosure = toIntArray( columnTableNumbers );
|
||||||
subclassPropertyTableNumberClosure = toIntArray( propTableNumbers );
|
subclassPropertyTableNumberClosure = toIntArray( propTableNumbers );
|
||||||
subclassColumnClosure = toStringArray( columns );
|
subclassColumnClosure = toStringArray( columns );
|
||||||
|
|
||||||
|
@ -970,12 +971,12 @@ public class JoinedSubclassEntityPersister extends AbstractEntityPersister {
|
||||||
&& subclassColumnClosure[i].endsWith( "\"" );
|
&& subclassColumnClosure[i].endsWith( "\"" );
|
||||||
if ( quoted ) {
|
if ( quoted ) {
|
||||||
if ( subclassColumnClosure[i].equals( columnName ) ) {
|
if ( subclassColumnClosure[i].equals( columnName ) ) {
|
||||||
return subclassColumnTableNumberClosure[i];
|
return subclassColumnNaturalOrderTableNumberClosure[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if ( subclassColumnClosure[i].equalsIgnoreCase( columnName ) ) {
|
if ( subclassColumnClosure[i].equalsIgnoreCase( columnName ) ) {
|
||||||
return subclassColumnTableNumberClosure[i];
|
return subclassColumnNaturalOrderTableNumberClosure[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue