siyamed wrote:
I guess that you have to. I mean you have to create two tables. That was how i solved the prblem, which seems to be logical for me. In the case where only the reference to the owning table is specified, there is no other way. But if there is a way to insert an extra column to the table which specifies from which (java) list the referencing table comes from , then the things change. That would be wonderful to learn it.
Thanks Simayed, I'm not entirely sure what you mean by "create two tables" though. Do you mean database tables? For ancestral relationship of the same entity type I can't imagine having two tables. A human's parents will always be humans, a dog's dam and sire will always be dogs (broad traditional assumptions here...).
In the end I have solved it with some slightly dubious method. The table has a Gender column so I basically map the two sets of progenies, ie. progeniesBySire, and progeniesByDam. These two properties and their getters/setters are private, only to be used by Hibernate.
I then have a third property, called "progenies". The getter checks what gender the Dog is and returns the appropriate set!
It all sounds very dodgy to me but it works so far...