deltaspike-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Luigi Bitonti <>
Subject Re: OrderByQueryStringPostProcessor
Date Wed, 30 Mar 2016 08:58:57 GMT
Hi John,
If you add the following test to in deltaspike-data-module:
    @Test    public void should_sort_all_result()    {        List<Simple>
result = repo.queryAll()
                .orderDesc(Simple_.counter)                .orderAsc( 
              .getResultList();    }
 You'll get the following error:

Tests in error:   should_sort_all_result(
org.hibernate.hql.internal.ast.QuerySyntaxException: Invalid path: 'e.counter' [select s from s order by e.counter DESC, ASC]
This is an overly simplistic case that could be worked around by using 'e' as an alias in
queryAll (instead of 's'), but in more complex case with joins and order by clauses that use
associated entities there's no workaround that I can see.
I tried (briefly I must confess) to work around this by creating an alternative QueryBuilderFactory
that could then allow me to avoid using WrappedQueryBuilder, DefaultQueryResult and (ultimately)
OrderByQueryStringPostProcessor but code duplication made the solution rather ugly, so I gave
up and decided to ask. 
    On Wednesday, March 30, 2016 12:32 AM, John D. Ament <> wrote:

Do you happen to have a test that can reproduce this?

On Tue, Mar 29, 2016 at 5:20 PM Luigi Bitonti <> wrote:

Hi all,
I am having issues with using the orderAsc and orderDesc methods on QueryResult as the order
by clause always ends up having an "e." prepended to its sort-by properties (e.g "...order
by e.i.date_from" instead of  "...order by i.date_from". Is there any way to avoid that
from happening?I am using Deltaspike 1.4.2 but from what I can see in the OrderByQueryStringPostProcessor
source this is still the case in 1.5.4 and also current git master.
Many thanks,Luigi 

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message