(sylvain.lavalley / www.laposte.net)
[using Hibernate 3]
<set name="..." inverse="true">
<key column="..."/>
<one-to-many class="..."/>
</set>
In such a set, <key column="..."/> should contain the key rerferencing the current class (the one definied by the file containing this exemple), not the id of the current class.
We often use the same name for this two ids, but it is not necessary.
If the id is incorrect, only one obect is loaded in the set.
A small example - 2 classes and their attributes :
- Class1 (id, id_class_2)
- Class2 (id)
In the mapping file of Class2, we should have :
<set name="class1" inverse="true">
<key column="id_class_2"/>
<one-to-many class="Class1"/>
</set>
and not
<set name="class1" inverse="true">
<key column="id"/>
<one-to-many class="Class1"/>
</set>