-->
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: Unable to map subclass with collection using discriminator
PostPosted: Wed Apr 26, 2006 6:23 am 
Newbie

Joined: Sun Oct 16, 2005 8:52 am
Posts: 4
I need to map a subclass based on a discriminator value, containing a collection and cannot find a way to do this.

I need to use method 9.1.4 from the hibernate docs to implment the inhertence, since the parent class has some info in a table, with a discriminator indicating the subclass type.

My problem is that I cannot map the set creditNotes below since this is not allowed by the DTD. However, I need to have this list available in my subclass. How do I go about this?

Hibernate version: 3

Mapping documents:
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping package="domain.tso">
    <class name="Document" table="document" schema="public">
        <id name="refId" type="integer">
            <column name="tso_ref_id" />
            <generator class="assigned" />
        </id>
       
        <discriminator column="tsotype" type="string" />

        <property name="createdDate" type="timestamp">
            <column name="created_date" length="8" />
        </property>

       <subclass name=Invoice" discriminator-value="INVOICE">
          <join table="invoice">
                <key column="id"/>
              <property name="supplier" type="integer">
                  <column name="supplier" />
              </property>
              <set name="creditNotes" inverse="true"> 
                  <key>
                      <column name="invoice" />
                  </key>
                  <one-to-many class="CreditNote" />
              </set>
          </join>
       </subclass>
      </class>


Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 26, 2006 11:11 am 
Beginner
Beginner

Joined: Sat Dec 17, 2005 1:24 pm
Posts: 42
Location: Berlin, Germany
Hi!

I had a similar problem (http://forum.hibernate.org/viewtopic.php?t=953843). Try if disabling lazy fetching for the collection (lazy="false") solves your problem. It did help me.

All the best,

René


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.