Hi everyone: 
I'm trying to implement a method that returns a criteria. The idea is that I get a full criteria (join of three tables) and later I want to compare firstly an attribute of the first class and later an attribute of the third class, so I do. 
Code:
return getSession().createCriteria(First.class,"fir").createAlias("second","sec").createAlias("third","thi");
When I debug it, in the variable crit I can see that sec's parent class is First.class and the thi's parent class is also First class, but actually, thi's parent class is Second.class. 
After that when I do 
Code:
add(Restrictions.eq(fir.name,x.getName()).add(Restrictions.eq(thi.name=y.getName()) 
I get this error:
Code:
could not resolve property: third of: x.x.x.x.x.first
My question is: Is there any way to use Criteria in order to get that thi's parent class is Second.class??? I suppose that is the reason why I get that error. 
Thank you very much in advance[/code]