使用Hibernate/SQL服務器,休眠計數,總和等
比方說,我有實體A,與compomnent實體AA,AB等,這些領域有X,Y,Z。
Query queryResult = s.createQuery("from A");
java.util.List A;
selectedA = queryResult.list();
我可以用
int countAa = A.getAas().size();
輕鬆獲得子實體的計數,但我怎麼可能做一些與像例如
int count = A.getAas() "where x = 2"
或
int count = A."get sum of Abs.y"
條件
我應該每次做一個新的查詢時間還是有另一種方式?
謝謝你的幫助。