Hi,
I have the following situation:
Code:
class A {}
class B {}
class C {
has a class D;
has a date;
}
class D {
has a class A
has a class B
}
I need to find all A's for a specific B on a specific date, that are related to C on that date.
So, my input is: B and date.
I need: A's that are related to C (by D) on the date.
My first step was:
Code:
Criteria critC = this.getSession().createCriteria(C.class);
critC.add(Restrictions.eq("date", date));
Criteria critD = critC.createCriteria("D");
critD.add(Restrictions.eq("B", B));
And when i do a critC.list(), i have all my C's on that date and related to B.
Now i need to filter that list to return A's entity, and use a distinct (yes, i might have repeated A's).
Im not sure how to do that using criteria...im kinda new to hibernate, and after some research, i have no idea how to do that.
Any help??
Thanks in advance!