JpaSpecificationExecutor JOIN + ORDER BY in Specification
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have a query using a JOIN and ORDER BY and want to use it within my repository using the Criteria Api. Here I found, how to wrap such a query into a CriteriaQuery ( Link ). CriteriaQuery<Pet> cq = cb.createQuery(Pet.class); Root<Pet> pet = cq.from(Pet.class); Join<Pet, Owner> owner = cq.join(Pet_.owners); cq.select(pet); cq.orderBy(cb.asc(owner.get(Owner_.lastName),owner.get(Owner_.firstName))); On the other side, I found some examples to use the Criteria Api in Combination with a JpaRepository ( example ). The Problem is that all methods