Dialect#getNullOrdering returns the default ordering of null for the database. So if you have values 1,null,2 and order by them, where does the DB put nulls by default. This is used to determine when the SQL can omit the nulls clause. In H2, null is the smallest, so the default implementation is to return SMALLEST, which means that order by x asc nulls first or order by x desc nulls last would be simplified to simply order by x and order by x desc. What your seem to want is specifying the default null precedence, which can be configured through hibernate.order_by.default_null_ordering, also see https://docs.jboss.org/hibernate/orm/6.2/javadocs/org/hibernate/cfg/AvailableSettings.html#DEFAULT_NULL_ORDERING. |