Skip to content
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

Order-by an attribute from a collection fails #261

Closed
marcelstoer opened this issue Oct 31, 2012 · 2 comments
Closed

Order-by an attribute from a collection fails #261

marcelstoer opened this issue Oct 31, 2012 · 2 comments

Comments

@marcelstoer
Copy link

@marcelstoer marcelstoer commented Oct 31, 2012

The following query fails in Querydsl 2.7.2 because it tries to order by an attribute from a collection:

QIntranetPublicationHandlung pubHand = ereignis.handlungen.any().as(QIntranetPublicationHandlung.class);

JPAQuery query = queryEreignis().where(
    pubHand.published.isTrue().and(
        pubHand.title.containsIgnoreCase(searchString).or(
        pubHand.message.containsIgnoreCase(searchString)))).orderBy(pubHand.startDate.desc());

org.hibernate.hql.internal.ast.QuerySyntaxException: unexpected token: . near line 10, column 43

which refers to order by any elements(ereignis.handlungen).startDate desc

@timowest
Copy link
Member

@timowest timowest commented Oct 31, 2012

any paths are internally expanded into sub queries which can only be used in the where part, so I will try to serialize any paths in the order by part like this

order by any ereignis.handlungen.startDate desc

This might trigger implicit joins, but is maybe a better option than disallowing any paths in the order by part.

@timowest
Copy link
Member

@timowest timowest commented Nov 19, 2012

Released in 2.9.0

@timowest timowest closed this Nov 19, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants