Commit 81f2d122a10ed545683507764626ff6d2899e8c1
Committed by
Andrew Shvayka
1 parent
b36f8513
precise reference to id
Showing
1 changed file
with
3 additions
and
2 deletions
... | ... | @@ -389,6 +389,7 @@ public class DefaultEntityQueryRepository implements EntityQueryRepository { |
389 | 389 | } else { |
390 | 390 | entityTypeStr = "'" + entityType.name() + "'"; |
391 | 391 | } |
392 | + | |
392 | 393 | if (!StringUtils.isEmpty(entityFieldsSelection)) { |
393 | 394 | entityFieldsSelection = String.format("e.id id, %s entity_type, %s", entityTypeStr, entityFieldsSelection); |
394 | 395 | } else { |
... | ... | @@ -442,9 +443,9 @@ public class DefaultEntityQueryRepository implements EntityQueryRepository { |
442 | 443 | EntityKeyMapping sortOrderMapping = sortOrderMappingOpt.get(); |
443 | 444 | String direction = sortOrder.getDirection() == EntityDataSortOrder.Direction.ASC ? "asc" : "desc"; |
444 | 445 | if (sortOrderMapping.getEntityKey().getType() == EntityKeyType.ENTITY_FIELD) { |
445 | - dataQuery = String.format("%s order by %s %s, id %s", dataQuery, sortOrderMapping.getValueAlias(), direction, direction); | |
446 | + dataQuery = String.format("%s order by %s %s, result.id %s", dataQuery, sortOrderMapping.getValueAlias(), direction, direction); | |
446 | 447 | } else { |
447 | - dataQuery = String.format("%s order by %s %s, %s %s, id %s", dataQuery, | |
448 | + dataQuery = String.format("%s order by %s %s, %s %s, result.id %s", dataQuery, | |
448 | 449 | sortOrderMapping.getSortOrderNumAlias(), direction, sortOrderMapping.getSortOrderStrAlias(), direction, direction); |
449 | 450 | } |
450 | 451 | } | ... | ... |