-->
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: Inheritance for dummies
PostPosted: Mon Feb 23, 2004 11:52 am 
Newbie

Joined: Mon Feb 23, 2004 11:43 am
Posts: 3
Hi, I'm new to Hibernate and I'm trying to make a persistent subclass to work.

Here's my TradeOrder.hbm.xml mapping:

?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping>
<!-- com.biz.orders.TradeOrder root -->
<class name="com.biz.orders.TradeOrder" table="TradeOrder" discriminator-value="T" mutable="true" polymorphism="implicit" dynamic-update="true" dynamic-insert="true" batch-size="1" select-before-update="false" optimistic-lock="version">
<id name="id" type="string">
<column name="id" length="16"/>
<generator class="native"/>
</id>
<discriminator column="subclass" type="character"/>
<property name="hora" column="hora" type="timestamp"/>
<property name="status" column="status" type="serializable"/>
<component name="user" class="com.biz.common.User">
<property name="password" column="password" type="string"/>
<bag name="accounts" table="accounts" lazy="true">
<key column="uid"/>
<element column="elm" type ="string"/>
</bag>
</component>
<property name="orderType" column="orderType" type="string"/>
<property name="stamp" column="stamp" type="timestamp"/>
<component name="account" class="com.biz.common.Account">
<property name="ID" column="IDAccount" type="string"/>
<bag name="permissions" table="permissions" lazy="true">
<key column="uid_1"/>
<element column="elm_1" type ="string"/>
</bag>
<property name="titular" column="titular" type="string"/>
</component>
<bag name="fills" table="fills" lazy="true">
<key column="uid_2"/>
<element column="elm_2" type ="string"/>
</bag>
<!-- com.biz.orders.SimpleOrder -->
<subclass name="com.biz.orders.SimpleOrder" discriminator-value="S" dynamic-update="true" dynamic-insert="true">
<property name="accion" column="accion" type="serializable"/>
<property name="size" column="size" type="float"/>
<property name="market" column="market" type="serializable"/>
<property name="PCode" column="PCode" type="string"/>
<!-- com.biz.orders.LimitOrder -->
<subclass name="com.biz.orders.LimitOrder" discriminator-value="L" dynamic-update="true" dynamic-insert="true">
<component name="price" class="com.biz.common.Price">
<property name="money" column="money" type="string"/>
<property name="magnitude" column="magnitude" type="float"/>
</component>
</subclass>
</subclass>
</class>
</hibernate-mapping>

I'm trying to insert a new record in the Trade Order table, inserting a Limit Order , and an Exception is thrown:

No persister for: com.biz.orders.LimitOrder
net.sf.hibernate.MappingException: No persister for: com.biz.orders.LimitOrder
at net.sf.hibernate.impl.SessionFactoryImpl.getPersister(SessionFactoryImpl.java:420)

What I'm doing wrong?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 23, 2004 11:55 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Have you checked the log if Hibernate is actually loading the mapping?


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.