如何在Spring数据JPA中实现动态查询?

时间:2018-10-30 05:37:20

标签: java spring spring-data-jpa jpql

@Query(value = "select ddc.id as skuID,slc.DESCRIPTION as descriptionID from Default_Table ddc JOIN SKU_CONFIG slc ON ddc.id = slc.id ORDER BY ?#{#pageable}",countQuery ="select count(*) from Default_Table",nativeQuery = true)

public Page<Object[]> getAllObject(Pageable pageable);

上面的查询是静态查询。但是如果我在域类中有多个属性,并基于该属性要进行分页排序,那么如何通过jpa中的动态查询来实现此目的?

0 个答案:

没有答案