HHH-15749 Hibernate fails when selecting grouped by entities in a specific order
This commit is contained in:
parent
a2aca9127c
commit
0745a2e294
|
@ -2288,11 +2288,11 @@ public abstract class BaseSqmToSqlAstConverter<T extends Statement> extends Base
|
|||
|
||||
private int indexOfExpression(List<? extends SqmAliasedNode<?>> selections, SqmExpression<?> node) {
|
||||
final int result = indexOfExpression( 0, selections, node );
|
||||
if ( result < 1 ) {
|
||||
return -result;
|
||||
if ( result < 0 ) {
|
||||
return -1;
|
||||
}
|
||||
else {
|
||||
return -1;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2308,27 +2308,27 @@ public abstract class BaseSqmToSqlAstConverter<T extends Statement> extends Base
|
|||
( (SqmDynamicInstantiation<?>) selectableNode ).getArguments(),
|
||||
node
|
||||
);
|
||||
if ( subResult < 0 ) {
|
||||
if ( subResult >= 0 ) {
|
||||
return subResult;
|
||||
}
|
||||
offset = subResult - i;
|
||||
offset = -subResult - i;
|
||||
}
|
||||
else if ( selectableNode instanceof SqmJpaCompoundSelection<?> ) {
|
||||
final List<SqmSelectableNode<?>> selectionItems = ( (SqmJpaCompoundSelection<?>) selectableNode ).getSelectionItems();
|
||||
for ( int j = 0; j < selectionItems.size(); j++ ) {
|
||||
if ( selectionItems.get( j ) == node ) {
|
||||
return -( offset + i + j );
|
||||
return offset + i + j;
|
||||
}
|
||||
}
|
||||
offset += selectionItems.size();
|
||||
}
|
||||
else {
|
||||
if ( selectableNode == node ) {
|
||||
return -( offset + i );
|
||||
return offset + i;
|
||||
}
|
||||
}
|
||||
}
|
||||
return offset + selections.size();
|
||||
return -( offset + selections.size() );
|
||||
}
|
||||
|
||||
private boolean selectClauseContains(SqmFrom<?, ?> from) {
|
||||
|
|
Loading…
Reference in New Issue