Sort nulls first/last

Hello community,

I have a CollectionContainer I want to sort by columns containing optional dates. If the collection is sorted by a date column containing nulls, I want the null rows always to reside at the end of the list.

At a first glance, this lookes like an easy job. Both CollectionContainer and CollectionLoader allow the use of Sort instances which are - according to the docs - based on Spring Data’s Sort class. However, CUBA’s implementation of this class seems to lack any NullHandling.

My question is therefore: How do I advise the data store to return nulls last on the CUBA platform?

Thanks in advance and best regards,
Manuel

Hi @mg111
Pay attention to Custom Sorting - CUBA Platform. Developer’s Manual.
You can create a custom sorter and change the order of the null values.