個或多個屬性查詢:
?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)>;
From:http://tw.wingwit.com/Article/program/Java/ky/201405/30837.html