go up to 3 level dephth in hibernate criterion

Posted by Satyajitsinh Raijada on Stack Overflow See other posts from Stack Overflow or by Satyajitsinh Raijada
Published on 2012-04-06T09:34:38Z Indexed on 2012/04/07 11:29 UTC
Read the original article Hit count: 144

Filed under:

i am using hibernate criterion for fetching results. Here with i provided demo design of my persistence class.

Class A{
private B b;
}
Class B{
private C c;
}
Class C{
private Long val;
}

assume these are the hibernate persistence classes i am not writing all annotations of mapping with database.

now my problem is i want to retrieve results of Class A according to the value of Class C's val property.

i tried to fetch it using,

Criteria c = Restrictions.eq("b.c.val", value);
List l = c.list;

it shows could not resolve property. i searched and came to know criteria wont work up to this much depth. i don't want shift to HQL. any idea??

© Stack Overflow or respective owner

Related posts about hibernate