I have a situation in which I think I need to mix the <join> and <joined-subclass. elements, but of course this is prohibited by the DTD. I wouldlike any help or suggestions...
I have a simple class heirarchy as follows:
Code:
Actor (abstract base class)
|
----------------------
| |
Organization Individual (concrete classes)
Actor has the following properties:
#Name
#Description
#StartDate
Organization and Individual have a couple properties of their own.
What complicates this is that the name and description are internationalized strings and therefore stored in a separate joined table in the database. The database schema for these is a follows (i cannot change the schema).
ActorActor_Id integer
StartDate date
...
ActorMessageActor_Id
Name
Description
Locale
OrganizationActor_Id
Industry
Region
...
IndividualAddress
...
Basically, I would like to join the Actor and ActorMessages using a <join> element to persits and retrieve the internationalized actor strings from two tables (into one actor object) whil also using the <joined-subclass> elements to define my table-per-subclass inheritance structure using the table schema i have. The mapping would look something like this...
Code:
<class name="com.sb.app.model.Actor" table="Actor">
<id name="id" column="Actor_Id">
<generator class="native"/>
</id>
<property name="startDate" column="StartDate" type="date"/>
<join table="ActorMessage">
<key column="Actor_Id"/>
<property name="name" column="Name" length="512"/>
<property name="description" column="Description" length="4000"/>
<property name="locale" column="Locale" length="5"/>
</join>
<joined-subclass name="Organization" table="Organization">
<key column="Actor_Id"/>
<property name="industry" column="Industry">
<property name="region" column="Region"/>
... other properties
</joined-subclass>
<joined-subclass name="Individual" table="Individual">
<key column="Actor_Id"/>
<property name="address" column="Address">
... other properties
</joined-subclass>
</class>
This seems like the ideal/most elegant way to describe my class model given the database schema, the problem is that the DTD doesn't allow the coexistence of the <join> and <joined-subclass> elements. I can't figure out another mapping strategy that will acheive exactly what my business model describes give the db schema. And the DB schema seems appropriate for the problem.
Any help is appreciated.
Regards,
Eric