Hi Om,
If your TABLE_C is an association table — i.e., it exists in order to impleement a relationship between A and B — then yes, that corresponds to a many-to-many association in Hibernate. But it doesn't sound like that is the case, because you said that "C is a child of both A and B". An association table would be used to implement a many-to-many association between A to B, i.e., "a B may be a child of many A's".
Terms like "many-to-many" refer to the ordinalites of the two ends of the relationship. It has nothing to do with how many objects a relationship participates in.
Beyond that, I can't tell you exactly how to map your classes, because I don't know (a) the howmany-to-howmany of the relationships, and (b) your navigability requirements (bidirectional? Or unidirectional, and if so from which end?) and (c) the collection semantics you require for each (Set? List?)
Is this a legacy RDB schema you have to code to? If not, I'd strongly recommend you drive this from the Java end and work your way down to the hibernate mappings, developing the schema as necessary to support the mappings.
|