I am currently encountering a problem with Hibernate where I create a HQL statement automatically which looks like
FROM table ORDER BY a.b ASC NULLS LAST
My intention was to order all entries by a.b and setting all entries where a or b is NULL to the end of the table. Hibernate does not complain about the statement, but just ignores all entries where a is NULL already. I experimented with setting:
FROM table ORDER BY NULLIF(a.b, NULL) ASC NULLS LAST
and again, Hibernate does not complain but again ignores all entries where a is NULL.
Thank you for your help!
Thank you for the answer, I found a different solution which was easier to implement. I now create a request as follows:
For me, this works for any dimensions of chains as long as these orders are ok. This is much easier for me to implement since the query is generated automatically. However, thank’s for the advice. I tried it and your solution works fine as well but would require me to adjust my overall setup.