New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Projections.bean discards aliases required for sorting #1379

Closed
zdila opened this Issue May 18, 2015 · 0 comments

Comments

Projects
None yet
2 participants
@zdila

zdila commented May 18, 2015

final List<Expression<?>> list = new ArrayList<>();
final NumberPath<Double> avgAmountPath = Expressions.numberPath(Double.class, "avgAmount");
list.add(QEntity.entity.amount.avg().as(avgAmountPath));
jpaQuery.groupBy(QEntity.entity.something);
jpaQuery.orderBy(avgAmountPath.asc());

// this throws exception: Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column 'avgAmount' in 'order clause'
jpaQuery.list(Projections.bean(MyResult.class, list.toArray(new Expression[0])));

// this is ok
jpaQuery.list(list.toArray(new Expression[0]));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment