Home » Support » Issue Tracking » Alias not used in ORDER BY

Alias not used in ORDER BY

Type: BugPriority: LowStatus: FixedReplies: 2
#1

Hi,

I am doing something simple like

final Root<T> from = criteria.from(T.class)
final Path<?> path = from.get("someStringProperty")
final Expression<String> upperPath = builder.upper((Expression<String>) path);
upperPath.alias("TEST");
criteria.multiselect(from, path);
criteria.orderBy(builder.asc(upperPath))

I would have expected the alias to be used in the ORDER BY clause, something like

SELECT $1, UPPER($1.someStringProperty) AS TEST FROM T ORDER BY TEST

However what I actually get as query string is

SELECT $1, UPPER($1.someStringProperty) AS TEST FROM T ORDER BY UPPER($1.someStringProperty)

This doesn't seem right to me..

Alex

#2

These queries are equivalent, but it will be fixed to make toString of criteria query more friendly.

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)
#3

Fixed in build  2.3.6_07.

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)

Post Reply

To post a reply and/or subscribe to update notifications - please login