Pri*_*nda 8 mysql openjpa spring-data spring-data-jpa
我需要我的数据按空排序而不是空排序。像下面这样:
Column A
null
null
null
8
10
5
Run Code Online (Sandbox Code Playgroud)
这意味着一旦所有空值都在顶部,其余的值根本不应该被排序并按原样出现。任何想法如何使用 jpa 查询/本机查询来完成。
如果你的项目使用 Spring Boot,你可以像这样添加 YML 配置,它对我有用。
spring:
jpa:
properties:
hibernate.order_by.default_null_ordering: last
Run Code Online (Sandbox Code Playgroud)
使用JPQL,你会很高兴。
SELET f FROM Foo f ORDER BY f.name NULLS LAST
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5749 次 |
| 最近记录: |