简体   繁体   English

春季:使用2个子句的派生查询?

[英]Spring: Derived Queries using 2 clauses?

I am currently using spring derived queries in my application. 我目前在我的应用程序中使用spring派生查询 Eg: 例如:

Dog findById(String id);

Is there a way to add 2 or more clauses to the derived queries? 有没有一种方法可以将2个或更多子句添加到派生查询中? eg: 例如:

Dog findByIdAndOwnerOrderByOwner();

You should be able to do something like this, 你应该可以做这样的事情,

Dog findByIdAndOwnerOrderByOwnerDesc(String id, String owner);

As long as you use AND or OR to concatenate your query, it should handle multiple clauses. 只要使用AND或OR串联查询,它就应该处理多个子句。 I also believe you need to specify the order by order (ASC/DESC). 我也相信您需要按订单指定订单(ASC / DESC)。

Check out Spring Data JPA for more information regarding this topic. 查看Spring Data JPA ,以获取有关此主题的更多信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM