tenwit wrote:
However in your case, I would recommend using polymorphic mapping, union-subclass. Section 9.1.5 of the ref docs explains it. You'll have one Address interface and two impl classes, CompanyAddressImpl and PersonAddressImpl.
Thx for the reply, my mapping use many-to-one unique=true inside a jointable node with optional=true (
<join table="PersonAddress" optional="true">
<key column="personId" unique="true"/>
<many-to-one name="address" column="addressId" not-null="true"/>
</join>) like described in 7.3
which implement a 0..1
If I understand well the mapping you suggest I end up with 2 tables for the two impl classes (PersonAddressImpl and CompanyAddressImpl) instead of my two relation classes...
I must be idiot, but I don't clearly see the pro of your solution.
Mr Chubbard I think my mapping work for you :
the tables in this example are :
person (id, and other column)
company (id, and other columns)
address(id, and other column)
personAddress(idPerson,IdAddress)
companyAddress(idCopany,idAddress)
And I have only 3 classes : person, company and address
If your legacy-you-cannot-touch db schema is like this I do think it will work for you.
regards,
TFlop