-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: How can I load inheritance mapping??
PostPosted: Thu Aug 26, 2004 11:28 am 
Newbie

Joined: Tue Aug 03, 2004 10:31 am
Posts: 7
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>


Top
 Profile  
 
 Post subject:
PostPosted: Fri Aug 27, 2004 8:11 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
just do session.load("from Action")


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.