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,