I have three tables, gateway, company, and affiliate. Both company and affiliate map to the same column in gateway. I use a column 'type' in the gateway table to figure out if it is a company or affiliate row.
Typically I will only want to update the company or affiliate table and not the gateway since the information in gateway will be set once, while the information in the other tables may be updated more often.
I also will always get to the gateway table through the company and affiliate tables, so the gateway doesn't need to know it's companies or affiliates except to insert/update.
So basically I need it to be like the following:
Affiliate ---> Gateway[RefID]
Company ---> Gateway[RefID]
With the affiliate and company within the gateway mapping being equivalent to a property that I can call with a simple getCompany or getAffiliate.
I have this same problem for another set of tables, except that it's five tables mapped to one, but I'm guessing the process is the same irregardless of the amount of tables one has.
This situation shouldn't be extremely uncommon so I'm guessing hibernate has a way to cope w/ it, just couldn't figure out how.
Thanks in advance for any help you can give me.
|