-->
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: How to map ternary association's entity in Map based col'ns?
PostPosted: Mon Mar 28, 2005 9:26 pm 
Regular
Regular

Joined: Fri Oct 01, 2004 2:19 am
Posts: 111
Location: Melbourne, Australia
Hibernate version: 3.0rc1

Is it possible to create a ternary association entity and have it mapped
on one side of the association (the collection side) as a map element
keyed on the element on the other side of the association?

The model of what I'm trying to map is:

Code:
class A
{
  Map<B, AssocEntity> collection;
}

class B
{
   ... some business domain fields
}

class AssocEntity
{
   private A owner;
   private B ref;
   
   //... Association fields like price, qty, count, whatever
}



Note that the association between A and B is 1:n and not many to many,
if it makes things easier

I have read the section about component mapping and ternary association
and certainly, AssocEntity can be realised using composite elements etc.
However, the collection side of the association is always a set, whereas
in my model I need it to be a map keyed on the referred entity so I can
look up the association and manipulate it.

Can someone shed some light on this and point me in the right direction?
I'm sure I'm just missing something obvious or have not read the right section in the manual.

Any help would be appreciated.

_________________
Cheers,

Bonny

please don't forget to rate :)


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 28, 2005 9:30 pm 
Regular
Regular

Joined: Fri Oct 01, 2004 2:19 am
Posts: 111
Location: Melbourne, Australia
An additional piece of info missing from the post above is that class B
is a base class to a hierarcy that is mapped using <any> (table per
concrete class) and the <map> element in Hibernate does not seem
to be able to use <any> as the key (but again, I may be missing
something obvious here).

_________________
Cheers,

Bonny

please don't forget to rate :)


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.