spring data jpa orderby 可以加多个参数吗
发布网友
发布时间:2022-04-26 00:18
我来回答
共3个回答
热心网友
时间:2023-08-18 08:16
findAllBySomeOrderOneAscTwo();
jpa多个内容排序
源码参考:
spring-data-commmons-1.13.4
PartTree.java
L370
public Predicate(String predicate, Class<?> domainClass) {
String[] parts = split(detectAndSetAllIgnoreCase(predicate), ORDER_BY);
if (parts.length > 2) {
throw new IllegalArgumentException("OrderBy must not be used more than once in a method name!");
}
buildTree(parts[0], domainClass);
this.orderBySource = parts.length == 2 ? new OrderBySource(parts[1], domainClass) : null;
}
OrderBySource.java
L65
public OrderBySource(String clause, Class<?> domainClass) {
this.orders = new ArrayList<Sort.Order>();
for (String part : clause.split(BLOCK_SPLIT)) { // BLOCK_SPLIT = "(?<=Asc|Desc)(?=\\p{Lu})";
// Do somethings for create OrderBySource
}
}
热心网友
时间:2023-08-18 08:17
配置多个sessionFactory,,中指定不同的sessionFactory
热心网友
时间:2023-08-18 08:17
配置sessionFactory指定同sessionFactory