Hibernate: Invalid ORDER BY expression

I tried to add some order to mine Criteria

like this.

crit.addOrder(Order.asc("priority")); // Not the real property though

      

And test on my system using MsAccess database using HSQLDialect And I get

Thrown by: org.hsqldb.HsqlException: Invalid ORDER BY expression

So, I tried to show the request, it reads like this:

Hibernate: 
/* criteria query */ select
    distinct this_.i_id as y0_ 
from
    T_FIT_ARTICLE this_ 
where
    (
        this_.b_export_ready=? 
        or this_.d_application_deadline>=?
    ) 
order by
    this_.d_application_deadline asc limit ? 
//FROM HERE THE STACK TRACE

      

The thing is, I used to use an annotation @OrderBy

in my collection that makes the same request and this works:

order by
    elements2_.i_order_nr asc limit ?

      

But with attributes in my Entity, this throws an exception.

By the way, if I try to test the same program with MYSQLSERVER

, it works great.

Any idea why and how I can avoid this?

Many thanks!

+3


source to share


1 answer


For anyone still interested: The problem was that I set up the projection of an attribute and set the orders of a different attribute. This does not appear to be supported by the dialect or the database.



0


source







All Articles