<id name="idInstance" type="java.lang.Integer">
<column name="ID_INSTANCE" />
<generator class="native" />
</id>
<property name="nom" type="string">
<column name="NOM" length="50" not-null="true" />
</property>
<property name="description" type="string">
<column name="DESCRIPTION" length="300" not-null="true" />
</property>
<set name="statistiques" cascade="all" lazy="false">
<key column="ID_INSTANCE"></key>
<one-to-many class="Statistique" />
</set>
</class>
and the hbm file of class statistique is :
<class name="Statistique" table="STATISTIQUE">
<id name="idStatistique" type="java.lang.Integer">
<column name="ID_STATISTIQUE"/>
<generator class="native" />
</id>
<property name="tempsReponse" type="java.lang.Double">
<column name="TEMPS_REPONSE"/>
</property>
<property name="date" type="timestamp">
<column name="DATE"/>
</property>
</class>
If the statistiques list is empty, this seems to be working fine. It fails with a foreign key violation error :
Integrity constraint violation FKD18D3C4EDC6F4BFB table: STATISTIQUE in statement [delete from INSTANCE_Monitor where (ID_INSTANCE) IN (select ID_INSTANCE from HT_INSTANCE_Monitor)]