HHH-17108 Error In Native Query when adding two Entity's and using composite key. Error: Unable to find column position by name.
This commit is contained in:
parent
d5e3f44479
commit
d6e695055e
|
@ -1754,6 +1754,9 @@ public abstract class AbstractEntityPersister
|
|||
final SelectClause selectClause = rootQuerySpec.getSelectClause();
|
||||
final List<SqlSelection> sqlSelections = selectClause.getSqlSelections();
|
||||
int i = 0;
|
||||
int columnIndex = 0;
|
||||
final String[] columnAliases = getSubclassColumnAliasClosure();
|
||||
final int columnAliasesSize = columnAliases.length;
|
||||
for ( String identifierAlias : identifierAliases ) {
|
||||
sqlSelections.set(
|
||||
i,
|
||||
|
@ -1762,6 +1765,9 @@ public abstract class AbstractEntityPersister
|
|||
new AliasedExpression( sqlSelections.get( i ).getExpression(), identifierAlias + suffix )
|
||||
)
|
||||
);
|
||||
if ( i < columnAliasesSize && columnAliases[i].equals( identifierAlias ) ) {
|
||||
columnIndex++;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
|
@ -1787,9 +1793,7 @@ public abstract class AbstractEntityPersister
|
|||
i++;
|
||||
}
|
||||
|
||||
final String[] columnAliases = getSubclassColumnAliasClosure();
|
||||
final String[] formulaAliases = getSubclassFormulaAliasClosure();
|
||||
int columnIndex =0;
|
||||
int formulaIndex = 0;
|
||||
for ( ; i < sqlSelections.size(); i++ ) {
|
||||
final SqlSelection sqlSelection = sqlSelections.get( i );
|
||||
|
|
Loading…
Reference in New Issue