Spring Data @Query返回投影

时间:2018-09-12 10:02:04

标签: spring spring-data spring-data-rest

我正在尝试从存储库返回自定义投影。到目前为止,我已经设法编写了查询,但是我没有得到很多有用的错误:找不到类型为com.sun.proxy。$ Proxy215类型的PersistentEntity!

@RestResource(path = "groupByService", exported = true, rel = "groupByService")
@Query(nativeQuery = true, value = "select count(vro.unique_id) as orderCount, vro.service_org_name,  vro.service_service_name,vro.service_procedure_name " +
        "from view_report_order as vro " +
        "   where vro.request_date between :startDate and :endDate" +
        "   group by vro.service_org_name," +
        "            vro.service_org_rgu_id, " +
        "            vro.service_service_name, " +
        "            vro.service_service_rgu_id, " +
        "            vro.service_procedure_name, " +
        "            vro.service_procedure_rgu_id "
)
List<OrderReportProjection> groupByService(@Param(value = "startDate") Date startDate, @Param(value = "endDate") Date endDate);



@Projection(name = "orderReport", types = {ViewReportOrder.class})
public interface OrderReportProjection {

Long getOrderCount();

String getServiceOrgName();

String getServiceServiceName();

String getServiceProcedureName();

}

以及如何向该方法添加分页?

0 个答案:

没有答案