- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在使用 hibernate 版本 3.6.10.Final 和 hibernate-jmx.version 3.5.6-Final.. 我有一个 Hibernate 标准
getCurrentSession().createCriteria(CustOrder.class)
.createAlias("custOrderSubStatusComments", "comment")
.setProjection(Projections.projectionList()
.add(Projections.groupProperty("id"))
.add(Projections.max("comment.id"))
.add(Projections.property("comment.value"), "val")
)
.add(Restrictions.eq("val", haltreason)).list();
此代码给出错误org.hibernate.QueryException:无法解析属性:val of:com.**.CustOrder
但是下面的代码工作正常。
getCurrentSession().createCriteria(CustOrder.class)
.createAlias("custOrderSubStatusComments", "comment")
.setProjection(Projections.projectionList()
.add(Projections.groupProperty("id"))
.add(Projections.max("comment.id"))
.add(Projections.property("comment.value"), "val")
)
.addOrder(Order.asc("val")).list();
我不明白为什么“val”对于排序有效而对于限制无效。
最佳答案
与“普通”SQL 相同。
select 子句是您作为查询结果呈现的内容。例如我不能执行以下操作...
select first_name f
from customer
where f='hello';
但是我可以...
select first_name f
from customer
where first_name='hello'
order by f;
如果可以的话,您将能够编写没有多大意义的表达式,例如......
select age + 10 as AgePlusTen
from Person
where AgePlusTen < 70;
如果你真的愿意,你可以使用子选择...
select * from (
select age + 10 as AgePlusTen
from Person
) where AgePlusTen < 70;
关于java - 带有投影 alise 的 Hibernate Criteria 限制,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56273089/
我正在尝试将以下别名与多个 "和 ' 一起使用,但我不清楚语法。我应该在每个候选人之前使用反斜杠吗? 总而言之,我该如何让它发挥作用? :) alias 'printenv |egrep -w "w
我正在使用 hibernate 版本 3.6.10.Final 和 hibernate-jmx.version 3.5.6-Final.. 我有一个 Hibernate 标准 getCurrentSe
我在练习中被要求从两列 List_price 和 discount_amount 中计算三个值。我的部分问题是我的编程本能会阻碍我完全掌握所教内容的能力。 谁能告诉我代码有什么问题,并提供一个模板来更
在 Oh My Zsh git 插件文档中 GitHub , 在列出的别名命令中有以下: 别名命令gpgit push 源 $(current_branch)加推git push origin "$(
我是一名优秀的程序员,十分优秀!