-->
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.  [ 1 post ] 
Author Message
 Post subject: Non-standard ternary association question
PostPosted: Wed Sep 06, 2006 9:40 am 
Newbie

Joined: Mon Aug 15, 2005 2:00 pm
Posts: 19
I have the following table structure (abbreviated for brewity):

Code:
table A (a_id PK)
table B (b_id PK)
table C (c_id PK, a_id FK ref A(a_id), b_id FK ref B(b_id))


Table C has an independent master-detail relationship with both A and B (and these two are not related in any way)

Here's what I'm trying to accomplish in Java:

Code:
class A {
    Map<B, Set<C>> mapping;
}
class B {
    // no link to the other two
}
class C {
    A a;
    B b;
}


In other words, instead of keeping A->C relationship as a simple master-detail (as it is), I'd like to get it grouped by B. Is it possible in Hibernate? I've been playing with ternary association, like that:

Code:
<class name="A">
   <map name="mapping">
      <key column="A_ID" />
      <map-key-many-to-many class="B" column="B_ID" />
      <one-to-many class="C" />
   </map>
</class>


but this seem to only map one instance of C for each B (so that I get a Map<B, C> structure).


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

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.