Hello, the question is:
In my object model I've got a hierarchy that represents the posible actions (
superclass Action,
subclasses Create, Pass, Get, Give, Destroy). In my relational model, I've got an only table which stores all these actions, that is, in the table ACTIONS, there is a row for an action:
Code:
ACTIONS
______________________
| ID | Description |
| | |
| 1 | CREATE |
| 2 | PASS |
| 3 | GET |
| 4 | GIVE |
| 5 | DESTROY |
``````````````````````
I want to persist this using
Hibernate 2.1.4 with SQL Server 7 and the mapping documents specified below.
Are mapping documents ok??
What I have to do to load these objects (the Action subclasses) from the relational database to the OO application ???
Thank you so much, Gervasio.
P.S: Excuse me for my english... I speak spanish!! ;)
Mapping documents:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC>
<hibernate-mapping>
<class name="Action" table="ACTIONS">
<id name="id" type="int" column="idOperacion">
<generator class="auto-increment"/>
</id>
<discriminator column="description" type="string"/>
<subclass name="Create" discriminator-value="CREATE">
</subclass>
<subclass name="Pass" discriminator-value="PASS">
</subclass>
<subclass name="Get" discriminator-value="GET">
</subclass>
<subclass name="Give" discriminator-value="GIVE">
</subclass>
<subclass name="Destroy" discriminator-value="DESTROY">
</subclass>
</class>
</hibernate-mapping>