-->
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: A difficult criteria to write .
PostPosted: Sat Mar 06, 2010 1:21 pm 
Newbie

Joined: Tue Mar 02, 2010 9:25 am
Posts: 7
I have Teacher entity and Student entity like this :

class Teacher {
public Long id ;
public Set<Student> students;
}

class Student {
public Long id ;
public Teacher teacher ;
public Boolean passedSemester1;
public Boolean passedSemester2;
}

You can assume my tables have the a the following structure.

Teacher and Student has a bidirectional one to many relationship. Student table manages the foreign key .

I need to find out the Teachers whose students all passed semester1 and semester2.

Actually I also need to search :

all failed to pass both semester1 and semester2 , all passed semester1 but failed to pass semester2 , all failed to pass semester1 but passed semester2 .

You could write any one of this queries , others should be no big differences.

In order to not cause other misunderstandings , I abstract my real problem into this simple one. I need join the two tables to do other complex queries , so it's not so easy as just to query the students table.

I am using Hibernate 3.1.3 , no patches has been applied .


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.