jpa CriteriaQueryNo explicit selection and an implicit one could not be determined

java.lang.IllegalArgumentException: Error occurred validating the Criteria
    。。。
Caused by: java.lang.IllegalStateException: No explicit selection and an implicit one could not be determined
View Code

使用JPA的Criteria进行安全类型的查询分页数据,执行抛出: No explicit selection and an implicit one could not be determined 异常,原因是使用CriteriaBuilder.createTupleQuery进行查询,没有置顶查询的结果集的列,需要使用 query.multiselect明确指定返回的列

posted @ 2019-09-14 11:53  星小梦  阅读(1259)  评论(0编辑  收藏  举报