Java Hibernate条件限制与投影alise
我使用的是hibernate版本3.6.10.Final和hibernate-jmx.3.5.6-Final。。我有一个休眠标准 getCurrentSession.createCriteriaCustOrder.class .createAliascustOrderSubStatusComments,comment .setProjectionProjections.projectionList .addProjections.groupPropertyid .addProjections.maxcomment.id .addProjections.propertycomment.value,val .addRestrictions.eqval、haltreason.list; 此代码给出错误org.hibernate.QueryException:无法解析属性:val of:com.*.CustOrder 但是下面的代码运行良好 getCurrentSession.createCriteriaCustOrder.class .createAliascustOrderSubStatusComments,comment .setProjectionProjections.projectionList .addProjections.groupPropertyid .addProjections.maxcomment.id .addProjections.propertycomment.value,val .addOrderOrder.ascval.list; 我不明白为什么val对排序有效,对限制无效。对普通SQL也是如此 select子句是作为查询结果显示的内容。例如,我不能做以下事情Java Hibernate条件限制与投影alise,java,hibernate,Java,Hibernate,我使用的是hibernate版本3.6.10.Final和hibernate-jmx.3.5.6-Final。。我有一个休眠标准 getCurrentSession.createCriteriaCustOrder.class .createAliascustOrderSubStatusComments,comment .setProjectionProjections.projectionList .addProjections.groupPropertyid .addProjections.m
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;