个或多个属性查询:
?Query query=sessioncreateQuery(select customernamecustomerid from Customer)
?List l=querylist();
?For(int i=;i<lsize();i++)
{
?Obejct[] object=(Object[])lget(i);
?Object[]? object[]
}
}
分组: ;select count(*)productname from Product group by productname order by productname;
取值与属性一样
配置的查询在*hbmxml中
?<query name=;sql;>
? <![CDATA[
? ?from Product where productid=:productid
? ]]>
</query>
?Query query=sessiongetNamedQuery(sql);
联接
?;from Customer as customer join fetch customerbuySet;将多的放到buySet属性中得出的结是Customer有一个Buy有多个
联接
;from Customer as customer join customerbuySet;:得出的对象customer与buy是对
子查询:
?;from Customer as customer where (select count(*) from customerbuySet)>;