Projections.bean discards aliases required for sorting #1379

Closed
zdila opened this Issue May 18, 2015 · 0 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]));
@johnktims johnktims closed this in #1382 May 29, 2015
@timowest timowest added this to the 4.0.1 milestone May 31, 2015
@timowest timowest removed the progress label May 31, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment