-->
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: many-to-ome multi column
PostPosted: Fri Mar 31, 2006 10:45 am 
Regular
Regular

Joined: Wed Sep 22, 2004 8:27 am
Posts: 89
Hibernate version: 3.1

Mapping documents:




Code:
    <class name="it.inform.w3.bean.ItemTypeProcessoConfigurazioneProprieta" table="W3T_PROPRIETA_CONFIGURAZIONI" select-before-update="true">
        <meta attribute="class-description">Proprieta configurazioni</meta>

         <composite-id name="id" class="it.inform.w3.bean.ItemTypeProcessoConfigurazioneProprietaPk">
               [b]<key-property    name="codentitt"  column="codentitt" type="long"/>[/b]            <key-property    name="codentpss"  column="codentpss" type="long"/>
            <key-property    name="codentcnf"  column="codentcnf" type="long"/>            
            <key-property    name="cafprp"      column="cafprp"      type="string" length="20"/>            
         </composite-id>
         
       <many-to-one class="it.inform.w3.bean.ItemTypeAttributo"  name="codentatt"  not-null="true" fetch="join" insert="false" update="false">
         [b]<column name="codentitt"/>[/b]
            <column name="codentatt"/>
       </many-to-one>
         
    </class>



Code:
    <class name="it.inform.w3.bean.ItemTypeAttributo" table="W3T_ATTRIBUTI" select-before-update="true">
        <meta attribute="class-description">Attributi</meta>

         <composite-id name="id" class="it.inform.w3.bean.ItemTypeAttributoPk">
               <key-property    name="codentitt"  column="codentitt" type="long"/>
            <key-property    name="codentatt"  column="codentatt" type="long"/>
         </composite-id>

        <property name="cafatt" type="string">
            <column name="cafatt" length="50" sql-type="string" not-null="true"/>
        </property>
       
        <property name="dscatt" type="string">
            <column name="dscatt" length="500" sql-type="string" not-null="true"/>
        </property>

        <many-to-one class="it.inform.w3.bean.Dominio"  name="codentdom"  not-null="true" fetch="join">
           <column name="codentdom" not-null="true"/>
        </many-to-one>

        <property name="cafwkfitt" type="string">
            <column name="cafwkfitt" length="8" sql-type="string" not-null="false"/>
        </property>

        <property name="cafwkfatt" type="string">
            <column name="cafwkfatt" length="30" sql-type="string" not-null="false"/>
        </property>

       
    </class>


How could i map this two table??? The column "codentitt" is a part of key of table ItemTypeProcessoConfigurazioneProprieta but the attribute "codentatt" is a many to one to table ItemTypeAttributo that has a primary key with 2 columns where 1 of these is "codentitt"

This map doesn't work.. which is the correct one?

thanks


Top
 Profile  
 
 Post subject:
PostPosted: Sun Apr 02, 2006 11:21 pm 
Expert
Expert

Joined: Thu Dec 23, 2004 9:08 pm
Posts: 2008
What error are you getting? "Doesn't work" doesn't help us decipher your problem..

Your mapping is very similar to the one in section 23.4.2. "Composite key example", of the ref docs. Compare your mapping to that, maybe that will help.


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.