-->
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: Problem with many-to-many relation (list) with composite-id
PostPosted: Fri Sep 29, 2006 3:07 am 
Newbie

Joined: Tue Aug 22, 2006 4:44 am
Posts: 7
Location: Madrid
Problem mapping many-to-many relation with composite-id:

I have the following situation:

The table ELABORATION is:

Code:
<hibernate-mapping">
  <class name="Elaboration" ltable="ELABORATIONS">
    <composite-id>
      <key-property name="name" type="string">
        <column name="NAME" not-null="true"/>
      </key-property>
      <key-property name="startApplicability" type="date">
        <column name="START_APPLICABILITY" not-null="true"/>
      </key-property>
    </composite-id>
  <property name="setInputs" type="integer">
      <column name="SET_INPUTS" not-null="true"/>
    </property>   
  <property name="description" type="string">
      <column name="DESCRIPTION" not-null="false"/>
    </property>
[b]  <list name="inputs" table="INPUTS" cascade="save-update">
      <key>
       <column name="ELABORATION"/>
   <column name='"SET"'/>            
     </key>               
      <many-to-many entity-name="Input">
         <column name="NAME"/>
         <column name='"SET_INPUTS"'/>        
      </many-to-many>
    </list>
[/b]

</hibernate-mapping>


and

Code:
<hibernate-mapping>
  <class name="Input" table="INPUTS">
    <composite-id>
      <key-property name="elaboration" type="string">
        <column name='"ELABORATION"' not-null="true"/>
      </key-property>
      <key-property name="set" type="integer">
        <column name='"SET"' not-null="true"/>
      </key-property>
      <key-property name="index" type="integer">
        <column name='"INDEX"' not-null="true"/>
      </key-property>
    </composite-id>
   
    <property name="parameter" type="string">
      <column name='"PARAMETER"' not-null="true"/>
    </property>   
    <property name="remarks" type="string">
      <column name='"REMARKS"' not-null="false"/>
    </property>           
  </class>
</hibernate-mapping>


and i want to retrieve a list ot Inputs associated with the elaboration name. It would be a many-to-many association. In the database there are not intermediate table and it is not possible to create it.

the database has the following structure

Table ELABORATIONS:

*NAME
*START_APPLICABILITY
*SET_INPUTS
DESCRIPTION

Table INPUTS:

*ELABORATION
*SET
*INDEX
PARAMETER

where the * means that the column is part of the primary key.

Can anyone help me? im really desperate


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.