Hibernate order by with nulls last

前端 未结 7 2098
谎友^
谎友^ 2020-11-30 03:42

Hibernate used with PostgreSQL DB while ordering desc by a column puts null values higher than not null ones.

SQL99 standard offers keyword \"NULLS LAST\" to declare

7条回答
  •  南方客
    南方客 (楼主)
    2020-11-30 04:23

    You can configure "nulls first" / "nulls last" in hibernate properties so it will be picked up by any criteria call by default: hibernate.order_by.default_null_ordering=last (or =first).

    See this hibernate commit for details.

提交回复
热议问题