当前位置: 动力学知识库 > 问答 > 编程问答 >

java - Spring: Derived Queries using 2 clauses?

问题描述:

I am currently using spring derived queries in my application. E.g:

Dog findById(String id);

Is there a way to add 2 or more clauses to the derived queries? e.g.:

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. I also believe you need to specify the order by order (ASC/DESC).

Check out Spring Data JPA for more information regarding this topic.

分享给朋友:
您可能感兴趣的文章:
随机阅读: