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.  [ 4 posts ] 
Author Message
 Post subject: wie bekomm ich die nicht zugeorneten objekte in many-to-many
PostPosted: Mon Jan 15, 2007 10:40 am 
Newbie

Joined: Mon Jan 15, 2007 8:21 am
Posts: 3
Hallo,

Ich habe die Klassen Course and Student und beide haben eine
many-to-many Beziehung zueinander.

Die Studenten, die einem Kurs zugeordnet sind, frag ich hier ab:

select elements(c.students) from Course as c where c.id=1

Aber wie kann ich die Studenten abfragen, die KEINEM Kurs
zugeordnet sind?

Gruß,

Michael

Hibernate version: 3.1.3


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 15, 2007 10:44 am 
Expert
Expert

Joined: Tue Nov 23, 2004 7:00 pm
Posts: 570
Location: mostly Frankfurt Germany
"from Stundenten s where size(s.kurse) = 0"

_________________
Best Regards
Sebastian
---
Training for Hibernate and Java Persistence
Tutorials for Hibernate, Spring, EJB, JSF...
eBook: Hibernate 3 - DeveloperGuide
Paper book: Hibernate 3 - Das Praxisbuch
http://www.laliluna.de


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 15, 2007 10:51 am 
Newbie

Joined: Mon Jan 15, 2007 8:21 am
Posts: 3
Danke für die schnelle Antwort!

Wie bekomm ich eigentlich die Kurse raus, die einem bestimmten Studenten noch nicht zugeordnet sind?

Danke,

Michael


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 15, 2007 12:45 pm 
Expert
Expert

Joined: Tue Nov 23, 2004 7:00 pm
Posts: 570
Location: mostly Frankfurt Germany
"select Kurs k where k not in (?)"
Und dann setParameterList mit student.getKurse verwenden

Ein Rating wäre nett ;-)

_________________
Best Regards
Sebastian
---
Training for Hibernate and Java Persistence
Tutorials for Hibernate, Spring, EJB, JSF...
eBook: Hibernate 3 - DeveloperGuide
Paper book: Hibernate 3 - Das Praxisbuch
http://www.laliluna.de


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

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.