问题描述:

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.

相关阅读:
Top