-->
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.  [ 1 post ] 
Author Message
 Post subject: Mapping a collection to a joined-subclass
PostPosted: Mon Mar 30, 2009 6:47 pm 
Newbie

Joined: Wed Mar 04, 2009 3:26 pm
Posts: 4
I have these mappings:

Code:
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
    assembly="MyProject.Dto" namespace="MyProject.Dto.AbstractEntities">

    <class name="AbstractItem" table="ABSTRACT_ITEM">
        <id name="Id" column="ID" type="Int32" unsaved-value="0">
            <generator class="identity" />
        </id>
        ...
        <joined-subclass name="MyProject.Dto.ConcreteItem, MyProject.Dto" table="CONCRETE_ITEM">
            <key column="ABSTRACT_ITEM_ID" />
            ...
        </joined-subclass>
    </class>
</hibernate-mapping>

<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
    assembly="MyProject.Dto" namespace="MyProject.Dto">

    <class name="User" table="USER">
        <id name="Id" column="ID" type="String">
            <generator class="assigned" />
        </id>
...
    </class>   
</hibernate-mapping>


My User entity needs a bag of ConcreteItems, but the relationship is a column in the ABSTRACT_ITEM table. I'm trying with this:

Code:
<bag name="ConcreteItems" inverse="true" cascade="all-delete-orphan">
            <key column="USER_ID"/>
            <one-to-many class="ConcreteItem" />
        </bag>


But I get an exception because the USER_ID column cannot be found in the CONCRETE_ITEM table. Any ideas please? Thanks!

_________________
Darth Reisender


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

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.