我想加入到与空值空值结果列表管理必须在最后离开。该选项添加到Order类两种不同的方式在SQL查询,但没有出现。我使用的是Oracle,如果从管理数据库空值结果展开磋商是在默认情况下,年底上市。
这是我的代码:
List<Order> orders = new ArrayList<Order>();
orders.add(new Order(Direction.DESC, "points"));
//THIS
orders.add(new Order(Direction.DESC, "person.date", NullHandling.NULLS_LAST));
//OR THIS
orders.add(new Order(Direction.DESC, "person.date").nullsLast());
//NOT WORKING
orders.add(new Order(Direction.DESC, "id"));
List<Foo> foos = fooRepository.findAll(new Sort(orders));
我怎么可以指定空结果应该走到尽头?
也许是有点晚了,但你可以看看这个(link)。
在我们的例子中,我们解决了它使用qazxsw POI通过uwolfer建议休眠财产;当我们试图用簧数据函数零点最后并没有为我们工作。
您可以设置在Spring(引导)hibernate.order_by.default_null_ordering
这个属性:
application.yml
我得到了同样的问题。
spring:
jpa:
properties:
hibernate.order_by.default_null_ordering: last
# or for first: hibernate.order_by.default_null_ordering: first
;
应生成SQL:为了通过递减零点最后但产生:为了通过递减(印章关闭空值最后)
我使用的这个相关性:
List<Sort.Order> orderList = new ArrayList<Sort.Order>();
orderList.add(new Sort.Order(Sort.Direction.DESC,"landArea",nullHandling.NULLS_LAST));
Pageable pageable = new PageRequest(0, PAGE_SIZE, new Sort(orderList));
Page<SearchSvcAttribsEntity> PropertySearchEntityList =
searchSvcAttribsRepository.findAll(PropertySearchSvcAttribsSpecs.findByCriteria(propertySearchCriteria), pageable)