-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Navigate through Set of objects from a hbm file.
PostPosted: Thu Nov 18, 2010 8:26 am 
Beginner
Beginner

Joined: Tue Aug 26, 2008 4:24 pm
Posts: 29
I have a problem with a set of objects in a hbm file. I have a table with students that has fk to table schools. Other table with classes that has a FK to schools. So in the hbm of schools I have a set of classes. Imagine that I want to get the students that study in the school x and study in the class x.
The problems is that I cannot do this:

From the table students I do:

filter.addCriterion("school", objectSchool)//fk
filter.addAlias("schools", "schools");
filter.addAlias("schools.classes", "class");
filter.addCriterion(Restrictions.eq("class.classId", new Integer(id)));

But the sql is not correct, I mean , I get all the students from the school objectSchool and not only the student from the class x. My question is:

How to resolve this with Criterions and not with HQL.

Thanks


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.