作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
下面是我的 jpa 代码。
CriteriaBuilder cb = entityManager.getCriteriaBuilder();
CriteriaQuery cq = cb.createQuery();
Root e = cq.from(Student.class);
cq.where(cb.greaterThan(e.get("id"), 3));
Query query = entityManager.createQuery(cq);
List<Student> students = query.getResultList();
最佳答案
我想您必须定义将从表中选择的列。
CriteriaBuilder cb = entityManager.getCriteriaBuilder();
CriteriaQuery<Student> cq = cb.createQuery(Student.class);
Root<Student> root = cq.from(Student.class);
cq.where(cb.greaterThan(e.get("id"), 3));
cq.select(root); // Which columns will be selected? Presuming all.
List<Student> studentList = entityManager.createQuery(cq).getResultList();
关于jpa - java.lang.IllegalStateException : No explicit selection and an implicit one could not be determined,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50231748/
我是一名优秀的程序员,十分优秀!