-->
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 composite (Gamma 163)
PostPosted: Fri Nov 14, 2003 12:58 pm 
Beginner
Beginner

Joined: Thu Sep 04, 2003 11:02 am
Posts: 20
Location: Montevideo, Uruguay
Hi,

I want to map a composite.
I have the following class hierarchy.

Code:
public interface IComponent {

//setters and getters for the common properties
}

public class Leaf implements IComponent{
//setters and getters for the common properties

}

public class CompositeElement implements IComponent{
//setter and getter for the common properties

//access and modifiers for the IComponent List

}


I'd like to map them in 3 tables.
Leaf[String1, String2, OID]

CompositeElement[String1, String2, OID]

CompElement_Composite[OID_CompElemet, OID_Component]

My mappings are as follows:
Code:
<hibernate-mapping>
    <class name="domainlayer.Leaf" table="Leaf">
        <id name="oid" type="string" unsaved-value="null" >
            <column name="OID" sql-type="char(32)" not-null="true"/>
            <generator class="uuid.hex"/>
        </id>
        <property name="String1">
            <column name="String1" sql-type="varchar(255)" not-null="false"/>
        </property>
<!--
    The remaining properties
-->
       </class>
</hibernate-mapping>
-------------
<hibernate-mapping>
    <class name="domainlayer.CompositeElement" table="CompositeElement">
        <id name="oid" type="string" unsaved-value="null" >
            <column name="OID" sql-type="char(32)" not-null="true"/>
            <generator class="uuid.hex"/>
        </id>
        <property name="String1">
            <column name="String1" sql-type="varchar(255)" not-null="false"/>
        </property>
<!--
    The remaining properties
-->
[color=red]<!--
    I guess my problem is here
-->[/color]
        <bag name="childs" table="CompElement_Composite" cascade="all">
            <key>
                <column name="OID_CompElemet" not-null="true"/>
            </key>
            <many-to-many class="domainlayer.[color=red]??[/color]">
                <column name="OID_Component" not-null="true"/>
            </many-to-many>
        </bag>
    </class>
</hibernate-mapping>


My unanswered questions is:
1- In the Bag I can-t map the interface. So wich class should I map?

Any help is apreciated.
thanks
Matauy


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.