-->
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.  [ 5 posts ] 
Author Message
 Post subject: Help with many to many hql select please
PostPosted: Fri Sep 24, 2004 7:40 am 
Regular
Regular

Joined: Fri Jul 16, 2004 3:04 pm
Posts: 52
Location: Wiltshire UK
Hibernate version:
2.1.6

Mapping documents:
Code:
<hibernate-mapping package="com.refdb">

    <class name="Release">
        <id name="id">
            <generator class="native"/>
        </id>
        <property name="name" unique="true"/>
        <set name="references" table="reference_release" cascade="all"  >
           <key column="release_id"/>
           <many-to-many column="reference_id" class="com.refdb.Reference"/>
        </set>
    </class>

</hibernate-mapping>

Code:
<hibernate-mapping package="com.refdb">

    <class name="Reference">
        <id name="id">
            <generator class="native"/>
        </id>
        <property name="name" unique="true"/>
        <property name="description"/>
        <property name="owner"/>
        <property name="creationDate"/>
        <property name="readyToMerge"/>
        <property name="conceptOrNL"/>
        <property name="dead"/>
        <set name="releases" table="reference_release" inverse="true" cascade="all">
           <key column="reference_id"/>
           <many-to-many column="release_id" class="com.refdb.Release"/>
        </set>
    </class>

</hibernate-mapping>


Code between sessionFactory.openSession() and session.close():
N/A

Full stack trace of any exception that occurs:
N/A

Name and version of the database you are using:
Oracle 8i

The generated SQL (show_sql=true):
N/A

Debug level Hibernate log excerpt:
N/A

Hi, I am trying to select all References who do not have any relationships to a Release. So any References who's releases collection is empty. Could someone please give me any pointers on how to do this using hql or Criteria?

Many Thanks
Paul

P.S. If Gavin or Christian read this, the synopsis for Hibernate in Action on Amazon.co.uk is wrong, I have emailed them about it, but they haven't changed it. You may want to check it out & contact them http://www.amazon.co.uk/exec/obidos/ASIN/193239415X/qid=1096025848/sr=2-1/ref=sr_2_11_1/026-1055243-7716415


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 24, 2004 7:58 am 
Hibernate Team
Hibernate Team

Joined: Thu Dec 18, 2003 9:55 am
Posts: 1977
Location: France
from Reference r where r.releases.size = 0

_________________
Anthony,
Get value thanks to your skills: http://www.redhat.com/certification


Top
 Profile  
 
 Post subject: THANKS
PostPosted: Fri Sep 24, 2004 8:06 am 
Regular
Regular

Joined: Fri Jul 16, 2004 3:04 pm
Posts: 52
Location: Wiltshire UK
Many thanks Anthony, I didn't realize it would be quite that simple :-) I love Hibernate more every day. I'm counting the days until my copy of Hibernate in Action arrives!

Paul


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 24, 2004 8:07 am 
Hibernate Team
Hibernate Team

Joined: Thu Dec 18, 2003 9:55 am
Posts: 1977
Location: France
that was in the reference guide... :-/

_________________
Anthony,
Get value thanks to your skills: http://www.redhat.com/certification


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 24, 2004 10:18 am 
Regular
Regular

Joined: Fri Jul 16, 2004 3:04 pm
Posts: 52
Location: Wiltshire UK
Thanks, Anthony I have found it in there now. I wouldn't have probably found it though without your help, as my thoughts were off on totally the wrong track, thinking about complicated joins :-)

Once again, many thanks for your help.

Paul


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 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.