j'ai deux classes en relation many-to-many
voilà mes données :
14 22
18 22
14 23
14 24
16 24
18 23
la première colonne represente une classe et l'autre colonne, l'autre classe.
<set name="Projets" table="RESSOURCE_PROJET" inverse="true" cascade="all-delete-orphan">
<key column="ID_R" />
<many-to-many class="fr.icdc.dei.fwk.sample.dto.Projet" column="ID_P" />
</set>
<set name="Ressources" table="RESSOURCE_PROJET" >
<key column="ID_P" />
<many-to-many class="fr.icdc.dei.fwk.sample.dto.Ressource" column="ID_R" />
</set>
dans mon prog je supprime la Ressource 22.
En résultat, je n'ai plus que la ligne suivante :16 24.
Pourquoi Hibernate me suprrime-t-il toutes les lignes en relation avec 22.
16:43:07,954 DEBUG SQL:310 - delete from HIBERNATE.RESSOURCE_PROJET where ID_P=?
Hibernate: delete from HIBERNATE.RESSOURCE_PROJET where ID_P=?
16:43:07,954 DEBUG IntegerType:59 - binding '14' to parameter: 1
16:43:07,954 DEBUG AbstractBatcher:27 - Adding to batch
16:43:07,964 DEBUG AbstractCollectionPersister:821 - done deleting collection
16:43:07,964 DEBUG AbstractBatcher:54 - Executing batch size: 2
16:43:07,974 DEBUG AbstractBatcher:80 - success of batch update unknown: 0
16:43:07,974 DEBUG AbstractBatcher:80 - success of batch update unknown: 1
16:43:07,974 DEBUG AbstractBatcher:284 - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
16:43:07,974 DEBUG AbstractBatcher:392 - closing statement
16:43:07,974 DEBUG UpdateTimestampsCache:51 - Pre-invalidating space [HIBERNATE.PROJET]
16:43:07,984 DEBUG BasicEntityPersister:2040 - Deleting entity: [fr.icdc.dei.fwk.sample.dto.Projet#18]
16:43:08,024 DEBUG BasicEntityPersister:2041 - Version: 2005-06-27 15:17:57.0
16:43:08,024 DEBUG AbstractBatcher:276 - about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
16:43:08,024 DEBUG SQL:310 - delete from HIBERNATE.PROJET where ID=? and DATE_MODIF=?
Hibernate: delete from HIBERNATE.PROJET where ID=? and DATE_MODIF=?
16:43:08,024 DEBUG AbstractBatcher:364 - preparing statement
16:43:08,094 DEBUG IntegerType:59 - binding '18' to parameter: 1
16:43:08,094 DEBUG TimestampType:59 - binding '2005-06-27 15:17:57' to parameter: 2
16:43:08,114 DEBUG AbstractBatcher:284 - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
16:43:08,114 DEBUG AbstractBatcher:392 - closing statement
16:43:08,204 DEBUG UpdateTimestampsCache:51 - Pre-invalidating space [HIBERNATE.PROJET]
16:43:08,204 DEBUG BasicEntityPersister:2040 - Deleting entity: [fr.icdc.dei.fwk.sample.dto.Projet#14]
16:43:08,214 DEBUG BasicEntityPersister:2041 - Version: 2005-06-27 15:30:35.0
16:43:08,214 DEBUG AbstractBatcher:276 - about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
16:43:08,214 DEBUG SQL:310 - delete from HIBERNATE.PROJET where ID=? and DATE_MODIF=?
Hibernate: delete from HIBERNATE.PROJET where ID=? and DATE_MODIF=?
16:43:08,485 DEBUG AbstractBatcher:364 - preparing statement
16:43:08,485 DEBUG IntegerType:59 - binding '14' to parameter: 1
16:43:08,495 DEBUG TimestampType:59 - binding '2005-06-27 15:30:35' to parameter: 2
16:43:08,505 DEBUG AbstractBatcher:284 - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
16:43:08,505 DEBUG AbstractBatcher:392 - closing statement
16:43:08,505 DEBUG UpdateTimestampsCache:51 - Pre-invalidating space [HIBERNATE.EXTERNE]
16:43:08,515 DEBUG UpdateTimestampsCache:51 - Pre-invalidating space [HIBERNATE.RESSOURCE]
16:43:08,515 DEBUG BasicEntityPersister:2040 - Deleting entity: [fr.icdc.dei.fwk.sample.dto.Externe#22]
16:43:08,515 DEBUG AbstractBatcher:276 - about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
16:43:08,515 DEBUG SQL:310 - delete from HIBERNATE.EXTERNE where Id=?
Hibernate: delete from HIBERNATE.EXTERNE where Id=?
16:43:08,525 DEBUG AbstractBatcher:364 - preparing statement
16:43:08,525 DEBUG IntegerType:59 - binding '22' to parameter: 1
16:43:08,535 DEBUG AbstractBatcher:284 - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
16:43:08,535 DEBUG AbstractBatcher:392 - closing statement
16:43:08,545 DEBUG BasicEntityPersister:2040 - Deleting entity: [fr.icdc.dei.fwk.sample.dto.Externe#22]
16:43:08,545 DEBUG BasicEntityPersister:2041 - Version: 2005-06-27 15:29:44.0
16:43:08,545 DEBUG AbstractBatcher:276 - about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
16:43:08,545 DEBUG SQL:310 - delete from HIBERNATE.RESSOURCE where ID=? and DATE_MODIF=?
Hibernate: delete from HIBERNATE.RESSOURCE where ID=? and DATE_MODIF=?
16:43:08,545 DEBUG AbstractBatcher:364 - preparing statement
16:43:08,555 DEBUG IntegerType:59 - binding '22' to parameter: 1
16:43:08,565 DEBUG TimestampType:59 - binding '2005-06-27 15:29:44' to parameter: 2
16:43:08,575 DEBUG AbstractBatcher:284 - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
16:43:08,595 DEBUG AbstractBatcher:392 - closing statement
16:43:08,605 DEBUG AbstractFlushingEventListener:294 - post flush
16:43:08,615 DEBUG JDBCContext:208 - before transaction completion
16:43:08,645 DEBUG SessionImpl:337 - before transaction completion
16:43:08,665 DEBUG JDBCTransaction:96 - committed JDBC Connection
16:43:08,665 DEBUG JDBCContext:213 - after transaction completion
16:43:08,675 DEBUG SessionImpl:353 - after transaction completion
16:43:08,675 DEBUG UpdateTimestampsCache:64 - Invalidating space [HIBERNATE.RESSOURCE_PROJET], timestamp: 4587396254412800
16:43:08,675 DEBUG UpdateTimestampsCache:64 - Invalidating space [HIBERNATE.RESSOURCE_PROJET], timestamp: 4587396254412801
16:43:08,675 DEBUG UpdateTimestampsCache:64 - Invalidating space [HIBERNATE.RESSOURCE_PROJET], timestamp: 4587396254412802
16:43:08,675 DEBUG UpdateTimestampsCache:64 - Invalidating space [HIBERNATE.PROJET], timestamp: 4587396254412803
16:43:08,675 DEBUG UpdateTimestampsCache:64 - Invalidating space [HIBERNATE.PROJET], timestamp: 4587396254412804
16:43:08,675 DEBUG UpdateTimestampsCache:64 - Invalidating space [HIBERNATE.EXTERNE], timestamp: 4587396254412805
16:43:08,685 DEBUG UpdateTimestampsCache:64 - Invalidating space [HIBERNATE.RESSOURCE], timestamp: 4587396254412805
la Interne avec comme ID 22 vient d'être supprimé.
16:43:08,945 DEBUG SessionImpl:246 - closing session
16:43:08,945 DEBUG AbstractBatcher:423 - closing JDBC connection (open PreparedStatements: 0, globally: 0) (open ResultSets: 0, globally: 0)
16:43:08,945 DEBUG DriverManagerConnectionProvider:129 - returning connection to pool, pool size: 1
16:43:08,945 DEBUG JDBCContext:213 - after transaction completion
16:43:08,945 DEBUG SessionImpl:353 - after transaction completion
fin du programme
j'ai trouvé une annomalie dans le script :
au début il y a ceci:
HIBERNATE.RESSOURCE_PROJET where ID_P=?
Hibernate: delete from HIBERNATE.RESSOURCE_PROJET where ID_P=?
il ne devrait pas y avoir ID_P=? mais ID_R=?
Essayer de m' aider parce que là j'en peut plus!!!!!!!
merci
|