steve wrote:
Well now it sounds like you are talking about inheritence which is really different from the initial question. Take a look at <joined-subclass/> as it sounds like what you want.
There you would have a BUSINESS table that held all the common attributes about a business regardless of its concrete type (name, address, etc). Additionally, you would have a LIENHOLDERS table with a shared PK relation to BUSINESS. LIENHOLDERS would hold attributes specific to lienholders (i.e. not shared with a general business).
We do use inheritance with Hibernate in many places.
I'm sorry, I probably misstated my problem. In my scenario a Business can be a Lienholder, Lessor, Insurance Company, etc etc. These 3 entities do not have any additional attributes, they are not subclasses of Business.
Their difference simply lies in where they exist in the domain. A Title object contains a Lessor of type "Business". A Registration object contains an Insurance Company of type "Business". And a Lien contains a LienHolder of type "Business".
They are all a Business instance with no further attributes. However rather than have a "Business" table that contains a mix of all of these types, we want a Lessor table, InsuranceCompany table, and LienHolder table. The mappings and columns are identical, just different tables.
I was hoping that when these relationships were defined in the mapping file that the table to use could, in some way, be overridden. What it gets down to is that a class maps to a table. However there are times we want a class to map to a different table (same mapping/attributes) based on where the foreign/key relationshiop exists.
I didn't want to have to maintain 3 sets of mappings for Business to be able to achieve this - but perhaps i do.
thanks for your patience and help.