90 words

Issue #127 - Alias not used in ORDER BY

BugVersion: Priority: LowStatus: FixedReplies: 2
#1
2012-01-17 00:46

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

quasado
quasado's picture
Joined on 2011-04-30
User Post #76
#2
2012-01-17 06:07

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)
support
support's picture
Joined on 2010-05-03
User Post #861
#3
2012-01-17 09:39

Fixed in build  2.3.6_07.

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)
support
support's picture
Joined on 2010-05-03
User Post #863

Post Reply

Please read carefully the posting instructions - before posting to the ObjectDB website.

  • You may have to disable pop up blocking in order to use the toolbar (e.g. in Chrome).
  • Use ctrl + right click to open the browser context menu in the editing area (e.g. for using a browser spell checker).
  • To insert formatted lines (e.g. Java code, stack trace) - select a style in the toolbar and then insert the text in the new created block.
  • Avoid overflow of published source code examples by breaking long lines.
  • You may mark in paragraph code words (e.g. class names) with the code style (can be applied by ctrl + D).
  • Long stack traces (> 50 lines) and complex source examples (> 100 lines) should be posted as attachments.
Attachments:
Maximum file size: 32 MB
Cancel