-->
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: Mapping two many-to-many relations.
PostPosted: Thu Mar 09, 2006 6:29 pm 
Beginner
Beginner

Joined: Mon Aug 15, 2005 4:37 pm
Posts: 27
Location: Washington DC
Hi,


Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:
3.0

Name and version of the database you are using:
Oracle 10G

I am trying to do a mapping for two many-to-many associations which are interlinked.

This means that

A<------->B
B<------->C

Suppose class A has attributes A_ID,A_NAME and similarly the class B has B_ID,B_NAME and class C has C_ID,C_NAME

A,B, C are three classes and are linked by a many-to-many relation.

The corresponding DB schema is like this.

A--->AB---->B
AB---->BC----->C

Table A has columns A_ID,A_NAME
Table AB has columns A_ID,B_ID
Table B has columns B_ID,B_NAME
Table BC has columns A_ID,B_ID,C_ID,D_ANOTHER_FIELD
Table C has columns C_ID,C_NAME

I would prefer if we don't require to have the AB,BC tables not to be present as corresponding Entity classes. Please note table BC has additional fields other than the Identifier fields

Can a mapping be done for this relation?

Thanks,
Surya


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 09, 2006 7:08 pm 
Expert
Expert

Joined: Mon Jan 09, 2006 5:01 pm
Posts: 311
Location: Sacramento, CA
check out pg 101 of reference.pdf it is almost identical (if not similar) to what you are talking about:

http://www.hibernate.org/hib_docs/v3/reference/en/pdf/hibernate_reference.pdf

_________________
-JT

If you find my replies helpful, please rate by clicking 'Y' on them. I appreciate it.


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.