1

我需要使用带有多个字段的投影的动态查询。类似的东西

DynamicQuery query = DynamicQueryFactoryUtil.forClass(Purchase.class);      query.add(PropertyFactoryUtil.forName("primaryKey.purchaseId,primaryKey.otherId").in(DynamicQueryFactoryUtil.forClass(ResponseField.class)          
                .add(PropertyFactoryUtil.forName("something").eq("something"))
                .setProjection(ProjectionFactoryUtil.property("primaryKey.purchaseId,primaryKey.otherId"))));

提前谢谢了!

4

1 回答 1

3

你可以这样做:

ProjectionList projectionList = ProjectionFactoryUtil.projectionList();

projectionList.add(projection1);
projectionList.add(projection2);

dynamicQuery.setProjection(projectionList);
于 2014-09-29T03:19:26.980 回答