Hi, We have the following code that maps the abstract class Person and its two derived classes profile1 and profile2. as follows:
<hibernate-mapping> <class name="Person" abstract="true"> <id name="id" column="id" type="long"> <generator class="..."> ... </generator> </id> <property name="p1"/> <property name="p2"/> <union-subclass name="Profile1" table="profile1"> <property name="p3"/> </union-subclass> <union-subclass name="Profile2" table="profile2"> <property name="p4"/> </union-subclass> </class> </hibernate-mapping>
now we have another class called Account that has all the properties defined in profile1 (p1,p2 & p3, in the above example) + some other properties encapsulated in Class OtherProps. We thought to define Account either as a subclass of Profile1 or as a composite of Profile1 and OtherProps.
The question is how to map Account to the DB using Hibernate. It seems as we need to mix startegies and as we understand this is impossible.
So what will be the best solution? any answer will be appriciated.
Amit
|