-->
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.  [ 4 posts ] 
Author Message
 Post subject: One to one mapping on composite key
PostPosted: Mon Mar 28, 2016 6:03 pm 
Newbie

Joined: Tue Jan 12, 2016 12:16 pm
Posts: 10
Hi,

I wonder how I can set a one-to-one mapping between 2 objects whereas both use composite keys.
Hivernate 4, with XML mapping "hbm" file.
I heard some persons using many-to-one mapping to do this


Top
 Profile  
 
 Post subject: Re: One to one mapping on composite key
PostPosted: Mon Mar 28, 2016 11:18 pm 
Hibernate Team
Hibernate Team

Joined: Thu Sep 11, 2014 2:50 am
Posts: 1628
Location: Romania
What have you tried so far?


Top
 Profile  
 
 Post subject: Re: One to one mapping on composite key
PostPosted: Tue Mar 29, 2016 4:38 am 
Newbie

Joined: Tue Jan 12, 2016 12:16 pm
Posts: 10
for the moment I've only tried one-to-one but I did not find in XML the properties de map all columns of my composite keys.

Here is the actual mapping below. "CROMOUVEMENT" is a detail table for "CROFINANCEREGLEMENT"

Code:
<class name="com...Report.FinancialPaymentReport" table="CROFINANCEREGLEMENT">
      <composite-id>
         <key-property name="pk" column="NUMMOUVEMENT"/>
         <key-property name="operationId" column="NUMOPERATION" />
         <key-property name="company" column="SOC"/>
         <key-property name="source" column="SOURCE"/>
      </composite-id>

      <property name="mode" column="CODEMODEREGLEMENT" />
      ....
   </class>

        <class name="com...Report.FinancialMovementReport" table="CROMOUVEMENT">
      <composite-id>
         <key-property name="pk" column="NUMMOUVEMENT"/>
         <key-property name="operationId" column="NUMOPERATION" />
         <key-property name="source" column="SOURCE"/>
      </composite-id>

      <property name="nature" column="NATURE" />
      <property name="transactionId" column="TRANSACTIONID" />
      <property name="bordereauId" column="BORDEREAUID" />

      <property name="declarationId" column="DECLARATIONID" />
      ....
   </class>


Top
 Profile  
 
 Post subject: Re: One to one mapping on composite key
PostPosted: Thu Mar 31, 2016 5:09 am 
Newbie

Joined: Tue Jan 12, 2016 12:16 pm
Posts: 10
Forget it. I've decided not to set FW on composite id. Too complicated and it's a specific usage in my project that is used sometimes.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.