-->
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: Bag with key-property ref
PostPosted: Tue Sep 18, 2007 2:57 pm 
Newbie

Joined: Mon Aug 06, 2007 4:28 pm
Posts: 3
Hibernate version: 3.1.3

Hi,

I have an object A with x , y , z has a key
Code:
<composite-id name="id" class="AID">
            <key-property name="p" column name="p" type="integer">
            <key-property name="x" column name="x" type="integer">
            <key-property name="y" column name="y" type="integer">
            <key-property name="z" column name="z" type="integer">
</composite-id>


and an object B with x,y,z,s, t, u
Code:
<composite-id name="id" class="BID">
            <key-property name="x" column name="x" type="integer">
            <key-property name="y" column name="y" type="integer">
            <key-property name="z" column name="z" type="integer">
            <key-property name="s" column name="s" type="integer">
            <key-property name="t" column name="t" type="integer">
</composite-id>


Ojbect A has a mapping many-to-one with B
Code:
<many-to-one name="relationB" insert="false" update="false" class="B" not-found="ignore" optimistic-lock="false">
          <column name="x"/>
         <column name="y"/>
         <column name="z"/>
         <formula>0</formula>
         <formula>0</formula>
      </many-to-one>



In my case, B can have a liste of A, then I tried to implement a bag with
a key-property ref like this:
Code:
<properties name="lienA">
       <property name="xLink" column="x" update="false" insert="false"/>
       <property name="yLink" column="y" update="false" insert="false"/>
       <property name="zLink" column="z" update="false" insert="false"/>
</properties>         
<bag name="listA" inverse="true">
       <key property-ref="lienA">
   <column name="x"/>
   <column name="y" />
   <column name="z"/>
       </key>
      <one-to-many class="AssureCouvert"/>
</bag>


When I tried to initialize my list with
Code:
getHibernateTemplate().initialize(b.getListA)


I have the following error:
Code:
IllegalArgumentException occurred calling getter of BID.x


I work on a legacy database that why I have those mapping.
Is there another way to map my list or I did something wrong in my mapping??

Thanks

Yves Lavoie


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.