Thankyou very much for your help. I'm almost there.
I have
<joined-subclass name="CorporateAccount" table="company">
<key column="account_id"/>
.....
and
<joined-subclass name="PersonAccount" table="person">
<key column="account_id"/>
.....
in my Account.hbm.xml
So this means that I have to create separate CorporateAccount.java & PersonAccount.java classes, as well as CorporateAccount.hbm.xml &
PersonAccount.hbm.xml files?
A particular account can be associated w/ many CorporateAccounts,
but only one PersonAccount. Do I need to map this somehow? Does
the <joined-subclass> above for CorporateAccount need an embedded <set> or something? Is one-to-many inherent in <joined-subclass>?
What does the CorporateAccount.java contain? A Set of Companies?
How about PersonAccount.java? A single Person?
thanks tenwit
tenwit wrote:
That's plain old table per subclass. You don't even have to make use of the discriminator (though you can if you like). A given account is going to have a row in either the company accounts table, or the person accounts table, but not both. The table per subclass section in the refdocs (9.1.2) fits your description perfectly.
The fact that the company accounts class includes a collection of person accounts is incidental to the polymorphism issue.
If you have trouble mapping this, post again.