I have a question about how to solve a design problem. My application has a Java Class which is mapped twice in the XML Hibernate mapping, as a component of two distinct "parent" Classes (not "parent" in the sense of inheritance, but "parent" in the sense of that which a dependent component is dependent upon). In each case, there is a one-to-one relationship between parent Class and component, so the component Class gets mapped twice, once into the table of each respective parents -- this works fine.
To this component, I now wish to add a one-to-many mapping of a third Class. This third Class is the same in the case of both components (remember that these components actually represent the same Java Class, anyway). Naturally, this new third Class (the "many" side of the one-to-many") must now be mapped into a new table. The problem is that objects of this one Java Class could now have a "parent" in either of the two originally-mentioned parent tables. This is, however, not so simple to define.
One possibility I've considered is to make the new third Class an interface in the Java world, and have it implemented by two seperate Classes, each mapped to a seperate table. Should this work in Hibernate? Is there a better solution to this problem?
Please let me know if I have not explained this clearly (I know it's a little confusing) and thanks in advance for any advice,