-->
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.  [ 3 posts ] 
Author Message
 Post subject: I am looking for an example of reflexive many-to-many
PostPosted: Mon Sep 18, 2006 3:45 pm 
Newbie

Joined: Mon Sep 18, 2006 3:33 pm
Posts: 6
I am looking for an example of reflexive many-to-many relation.

Let say i have a table User.

User:

id: int primary key
name: varchar2
surname: varchar2

and the relation table UserFriends

UserFriends:

userid: int foreign key
friendid: int foreign key

How could i map this ?

Thanx for your suggestion. :)


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 18, 2006 11:02 pm 
Senior
Senior

Joined: Sun Jun 04, 2006 1:58 am
Posts: 136
i dont know what you mean by "reflexive"
bute here is the ref doc for many to many

http://www.hibernate.org/hib_docs/v3/reference/en/html/associations.html#assoc-unidirectional-join-m2m

_________________
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 19, 2006 5:17 am 
Newbie

Joined: Mon Sep 18, 2006 3:33 pm
Posts: 6
Thanx for your answer scarface :)

In fact what i mean with 'reflexive' is a relation many-to-many with
the same table:

for example, in a entity, relation schema, it could be

-------------------
PERSON | <--- The entity
-------------------
| {0,n} | {0,n}
| |
| |
( Is Friend of ) <--- The relation


A person P1 could have friends (persons P2,P3,P4).
Person P2 could have no friend.
Person P3 could have friends (persons P4,P5).
ans so on ...

I have found what an answer to my problem.
In fact this special kind of many-to-many can be map
in the same way other many-to-many.

Still Thanx


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