This week's book giveaway is in the Mac OS forum. We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line! See this thread for details.
on his book "Spring Persistence with Hibernate" Ahmad Reza Seddighi discusses alternatives to mapping inheritance hierarchy in Hibernate (pages 102-103). On the example we have Person, Student and Teacher entities. Student and Teacher extend Person. On the example Ahmad is demonstrating "One table for each concrete class" solution for the mapping inheritance problem. Now Ahmad rises question where Address entity is added to schema. This is excat quote:
If Address has a many-to-one relationship with Person (more than one person may have the same address), then the ADDRESS table should provide a foreign key reference to all PERSON, STUDENT, and TEACHER tables, in order to establish database-level relationship, but this is not possible.
I'm confused why is that not possible. Why it would be impossible to have, lets-say "AddessID", column/foreign key for PERSON,STUDENT and TEACHER tables?
With the example they suggest the multiplicity of the association is reversed. An address_id field on person for example means one address can be used by zero or more persons, and a person can have one address (or zero if the fk is nullable) . A person_id on address means a person can have many addresses, though an address itself can only be used by one person.
I think you are misunderstanding what is meant by many-to-one. Cardinality is described as the relationship from one entity to another, so many-to-one is many addresses to one person. That is not possible with an address id defining the relationship on the person table. However (like I said) the reverse is.