Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version: 3.0.3 
PostgreSQL
Problem:
supose the follow classes A, B e C:
====================================================
A "has one" B 
A "has many" (a collection) of B
B "has many" (a collection) of C 
C "has one" int value
====================================================
So, in example we have:
====================================================
public class A {
  private B b;
  private Collection<B> bColllection;
  //... bean methods ...
}
public class B {
  private Collection cCollection;
  //... bean methods ...
}
public class C {
  private int value;
  //... bean methods ...
}
====================================================
Well, I need read "all A objects where the sum of all "value" field of all C object in A.b and A.bCollection is not equal to zero (0)"
In other words, I want something like this:
==============================================
FOR ALL "C" IN "A.B.CCOLLECTION":
  SUM += SUM( "C".VALOR )
END FOR
FOR ALL "B" IN "A.BCOLLECTION"
  FOR ALL "C" IN "B.COLLECTION"
    SUM += SUM ( "C".VALOR )
  END FOR
END FOR
IF SUM <> 0
  RETURN "A"
==============================================
Now, I have a question: 
How to do this using HQL to read this "A" objects from database?
Thank you
-- 
Cristiano Meira Magalhães