-->
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: help with one-to-one
PostPosted: Fri Sep 01, 2006 10:51 am 
Newbie

Joined: Fri Oct 28, 2005 9:08 am
Posts: 12
Hello,

I want to map a one-to-one unidirectional association on the primary key.

The 2 business obects are the followings :

Code:
public class Client {
        private String clientNumber;  //NUMCLI of CLD01
        //other properties...
}

public class Code {
        private Client client;   //NUMCLI of CLD09
        //other poperties
}


For the mapping files, I have this :

Code:
<class name="Client" table="CLD01">
            <id name="clientNumber" type="string" column="NUMCLI">
                     <generator class="assigned"/>
           </id>
           <!-- other properties -->
</class>


I don't understand how I have to map the other class : in the documentation, I see always the id property + the property for the association :

Code:
<class name="BicCode" table="CLD09">
   <id name="id" column="NUMCLI">
        <generator class="foreign">
              <param name="property">client</param>
        </generator>
    </id>
    <one-to-one name="client" constrained="true"/>
</class>


Is the property "id" mandatory in the business object ? This means I have to add it in the Code business object ? For me, the client is the id.

Thanks in advance,

_________________
Jérémie Balcaen


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.