In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces SpringBoot JPA sort multi-attribute sorting example analysis, the article is very detailed, has a certain reference value, interested friends must read!
SpringBoot JPA sort Multi-attribute sorting
In developing JPA, you encounter situations where you need to sort data in multiple attributes, such as
select * from MldmasView order by vslName ASC,custName ASC,docDate DESC; import jar package import org.springframework.data.domain.Sort.Order; code examples List list = new ArrayList();Order order1 = new Order (Direction.ASC, "vslName"); Order order2 = new Order (Direction.ASC, "custName");Order order3 = new Order(Direction.DESC, "docDate");list.add(order1);list.add(order2);list.add(order3);Sort sort = Sort.by (list);final List mldmasViews = this.mldmasViewRepository .findAll(sort);
Finish sorting mldmasViews
Error reporting using Sort in a Sping Boot project
Today, when using Sort, the following error is displayed
'Sort(org.springframework.data.domain.Sort.Direction, java.util.List)' in 'org.springframework.data.domain.Sort'
has private access in
Check it out and say that it is springboot2.2.1 (inclusive) version Sort can no longer be instantiated, the construction method is already private!
Sort.by can be used instead to get the Sort object
The above is "SpringBoot JPA sort multi-attribute sorting example analysis" all the content of this article, thank you for reading! Hope to share the content to help everyone, more relevant knowledge, welcome to pay attention to the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.