Order-by an attribute from a collection fails #261

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

Comments

Projects
None yet
2 participants
@marcelstoer

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

This comment has been minimized.

Show comment
Hide comment
@timowest

timowest Oct 31, 2012

Member

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.

Member

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

This comment has been minimized.

Show comment
Hide comment
@timowest

timowest Nov 19, 2012

Member

Released in 2.9.0

Member

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