Bonjour,
Voila mon problème, j'ai 2 tables Lot et Fonction avec l'id du lot en foreignKey dans la table fonction.

Au niveau des Entités j'ai tout bien déclaré avec dans la classe Lot
@OneToMany(mappedBy = "lot", cascade = { CascadeType.REMOVE })
private Set<Fonction> fonctions = new HashSet<Fonction>();
Quand je créé un lot puis une fonction, et que je cherche a supprimer ce lot assez rapidement j'ai une erreur de contrainte d'intégrité qui est lancé. Car Hibernate lance les requêtes suivantes :
select projet0_.PRO_ID as PRO1_0_, projet0_.PRO_VERSION as PRO2_0_, projet0_.PRO_NOM as PRO3_0_ from T_PROJET_PRO projet0_ order by projet0_.PRO_NOM
2008-08-29 11:29:19 959 DEBUG - update T_LOT_LOT set LOT_VERSION=?, LOT_NOM=?, PRO_ID=? where LOT_ID=? and LOT_VERSION=?
2008-08-29 11:29:19 997 DEBUG - delete from T_LOT_LOT where LOT_ID=? and LOT_VERSION=?
Par contre si j'attends un certain temps, la suppression du lot se fait correctement car Hibernate lance les requêtes suivantes :
select fonctions0_.LOT_ID as LOT4_1_, fonctions0_.FCT_ID as FCT1_1_, fonctions0_.FCT_ID as FCT1_9_0_, fonctions0_.FCT_VERSION as FCT2_9_0_, fonctions0_.FCT_NOM as FCT3_9_0_, fonctions0_.LOT_ID as LOT4_9_0_ from T_FONCTION_FCT fonctions0_ where fonctions0_.LOT_ID=?
2008-08-29 11:32:50 715 DEBUG - select ftc0_.FCT_ID as FCT2_3_, ftc0_.TYP_ID as TYP1_3_, ftc0_.CPX_ID as CPX3_3_, ftc0_.TYP_ID as TYP1_2_2_, ftc0_.FCT_ID as FCT2_2_2_, ftc0_.CPX_ID as CPX3_2_2_, ftc0_.FTC_NB_JH as FTC4_2_2_, type1_.TYP_ID as TYP1_5_0_, type1_.TYP_VERSION as TYP2_5_0_, type1_.TYP_NOM as TYP3_5_0_, complexite2_.CPX_ID as CPX1_7_1_, complexite2_.CPX_VERSION as CPX2_7_1_, complexite2_.CPX_NOM as CPX3_7_1_ from TJ_FCT_TYP_CPX_FTC ftc0_ left outer join T_TYPE_TYP type1_ on ftc0_.TYP_ID=type1_.TYP_ID left outer join T_COMPLEXITE_CPX complexite2_ on ftc0_.CPX_ID=complexite2_.CPX_ID where ftc0_.FCT_ID=?
2008-08-29 11:32:50 728 DEBUG - select etapes0_.LOT_ID as LOT2_2_, etapes0_.ETP_ID as ETP1_2_, etapes0_.ETP_ID as ETP1_1_1_, etapes0_.LOT_ID as LOT2_1_1_, etapes0_.JEL_COEF as JEL3_1_1_, etape1_.ETP_ID as ETP1_8_0_, etape1_.ETP_VERSION as ETP2_8_0_, etape1_.ETP_NOM as ETP3_8_0_, etape1_.ETP_POURCENTAGE as ETP4_8_0_, etape1_.PHA_ID as PHA5_8_0_ from TJ_ETP_LOT_JEL etapes0_ left outer join T_ETAPE_ETP etape1_ on etapes0_.ETP_ID=etape1_.ETP_ID where etapes0_.LOT_ID=?
2008-08-29 11:32:50 730 DEBUG - select ltc0_.LOT_ID as LOT2_3_, ltc0_.TYP_ID as TYP1_3_, ltc0_.CPX_ID as CPX3_3_, ltc0_.TYP_ID as TYP1_10_2_, ltc0_.LOT_ID as LOT2_10_2_, ltc0_.CPX_ID as CPX3_10_2_, ltc0_.LTC_COEF as LTC4_10_2_, type1_.TYP_ID as TYP1_5_0_, type1_.TYP_VERSION as TYP2_5_0_, type1_.TYP_NOM as TYP3_5_0_, complexite2_.CPX_ID as CPX1_7_1_, complexite2_.CPX_VERSION as CPX2_7_1_, complexite2_.CPX_NOM as CPX3_7_1_ from TJ_LOT_TYP_CPX_LTC ltc0_ left outer join T_TYPE_TYP type1_ on ltc0_.TYP_ID=type1_.TYP_ID left outer join T_COMPLEXITE_CPX complexite2_ on ltc0_.CPX_ID=complexite2_.CPX_ID where ltc0_.LOT_ID=?
2008-08-29 11:32:50 732 DEBUG - update T_LOT_LOT set LOT_VERSION=?, LOT_NOM=?, PRO_ID=? where LOT_ID=? and LOT_VERSION=?
2008-08-29 11:32:50 734 DEBUG - update T_FONCTION_FCT set FCT_VERSION=?, FCT_NOM=?, LOT_ID=? where FCT_ID=? and FCT_VERSION=?
2008-08-29 11:32:50 737 DEBUG - delete from T_FONCTION_FCT where FCT_ID=? and FCT_VERSION=?
2008-08-29 11:32:50 739 DEBUG - delete from T_LOT_LOT where LOT_ID=? and LOT_VERSION=?
J'aimerai savoir si c'est normal. Et s'il s'agit d'une configuration que j'aurais mal faite quelque part.