-->
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.  [ 2 posts ] 
Author Message
 Post subject: many-to-many to the same class
PostPosted: Sun Dec 04, 2005 2:44 pm 
Is it possible to use a many-to-many relationship to the same class, without having to duplicate the relationships in the linktable?

E.g.:

Code:
<class name="User" table="users">
    <id name="Id" column="id" type="long">
      <generator class="sequence">
        <param name="sequence">users_id_seq</param>
      </generator>
    </id>

    <property name="Username" column="username" type="string" />

    <bag name="Friends" table="friends">
      <key column="user1" />
      <many-to-many column="user2" class="User" />
    </bag>
  </class>


This works only one way, because NHibernate only selects the users where the current user's id is in the user1 column, not when its in user2.


Top
  
 
 Post subject:
PostPosted: Mon Dec 05, 2005 10:59 am 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
Hmm, I don't think this can be made to work in NHibernate.


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