Pour une one-to-many le mapping est le suivant:
Code:
<hibernate-mapping>
<class name="Pere" table="TABLE_PERE" >
<id name="code">
<column name="PK_CODE" length="10" />
<generator class="assigned" />
</id>
<one-to-many name="groupeParent" class="Pere"
fetch="select"
cascade="save-update">
<column name="FK_PERE_CODE" length="10" />
</one-to-many>
<property name="libelle">
<column name="LIBELLE" />
</property>
</class>
</hibernate-mapping>
et la table PERE:
Quote:
1 PK_CODE CHAR(10 BYTE) Y
2 LIBELLE VARCHAR2(80 BYTE)
3 FK_PERE_CODE CHAR(10 BYTE)
Pour une <one-to-one> je pense qu'il suffit de remplacer <one-to-many> .