-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: Anomalies dans le SQL généré (requetes non-nécessaires)
PostPosted: Wed Aug 10, 2005 6:36 am 
Newbie

Joined: Wed Aug 10, 2005 6:26 am
Posts: 8
voila je suis sous Hibernate3

en jetant un coup d'oeil dans les logs, je mes uis apercu qu'Hibernate génere des requetes sql inutiles et incohérente:
g le schéma suivant:
Caracteristique * -------- Carac_Produit --------- * Produit
numC . valeur . numP
libelle

carac_produit est mappé en élément composite pour un Set (donc pas de requete hql possible)
une partie du mapping

Quote:
<hibernate-mapping>

<class name="dao.Produit" table="PRODUIT">

<id name="numProduit" type="int" unsaved-value="null" >
<column name="numProduit" sql-type="int(11)" not-null="true"/>
<generator class="increment" />
</id>

...

<set name="listCaract" table="CARAC_PRODUIT" lazy="true">
<key column="numP"/>
<composite-element class="dao.CaracProduit">
<property name="valeur" column="valeur" />
<many-to-one name="carac" column="numCarac" />
</composite-element>
</set>

</class>

</hibernate-mapping>




pour récupérer les caractéristiques d'un produit + les valeurs associées g la fonction suivante:

Code:
Code:
public Set<CaracProduit> getCaractProduitById(int idProduit ) throws Exception {
        Session session = this.getSession();
        Transaction tx = session.beginTransaction();
       
        Produit p = (Produit) session.load(Produit.class, idProduit);
        Set<CaracProduit> lst = p.getListCaract();
        for (CaracProduit car: lst){
            Hibernate.initialize(car.getCarac());
        }
        tx.commit();
        session.flush();
        return lst;
    }


je récupere un produit puis je récupere la liste des carac_produits (valeurs) puis je charge les éléments caractéristiques (a cause du lazy loading)


Voici la requete générée
Quote:
Citation:

Hibernate: select produit0_.numProduit as numProduit0_, produit0_.libelleP as libelleP7_0_, produit0_.designationP as designat3_7_0_, produit0_.refFourProduit as refFourP4_7_0_, produit0_.prixP as prixP7_0_, produit0_.stockP as stockP7_0_, produit0_.nbConsultation as nbConsul7_7_0_, produit0_.promo as promo7_0_, produit0_.etatP as etatP7_0_, produit0_.refCategorie as refCate10_7_0_, produit0_.refConstructeur as refCons11_7_0_ from PRODUIT produit0_ where produit0_.numProduit=?

Hibernate: select listcaract0_.numP as numP0_, listcaract0_.valeur as valeur0_, listcaract0_.numCarac as numCarac0_ from CARAC_PRODUIT listcaract0_ where listcaract0_.numP=?

Hibernate: select caracteris0_.numCaracteristique as numCarac1_0_, caracteris0_.libelleCarac as libelleC2_10_0_ from CARACTERISTIQUE caracteris0_ where caracteris0_.numCaracteristique=?
Hibernate: select caracteris0_.numCaracteristique as numCarac1_0_, caracteris0_.libelleCarac as libelleC2_10_0_ from CARACTERISTIQUE caracteris0_ where caracteris0_.numCaracteristique=?
Hibernate: select caracteris0_.numCaracteristique as numCarac1_0_, caracteris0_.libelleCarac as libelleC2_10_0_ from CARACTERISTIQUE caracteris0_ where caracteris0_.numCaracteristique=?
Hibernate: select caracteris0_.numCaracteristique as numCarac1_0_, caracteris0_.libelleCarac as libelleC2_10_0_ from CARACTERISTIQUE caracteris0_ where caracteris0_.numCaracteristique=?
Hibernate: select caracteris0_.numCaracteristique as numCarac1_0_, caracteris0_.libelleCarac as libelleC2_10_0_ from CARACTERISTIQUE caracteris0_ where caracteris0_.numCaracteristique=?
Hibernate: select caracteris0_.numCaracteristique as numCarac1_0_, caracteris0_.libelleCarac as libelleC2_10_0_ from CARACTERISTIQUE caracteris0_ where caracteris0_.numCaracteristique=?
Hibernate: select caracteris0_.numCaracteristique as numCarac1_0_, caracteris0_.libelleCarac as libelleC2_10_0_ from CARACTERISTIQUE caracteris0_ where caracteris0_.numCaracteristique=?


mais la suite est plus génante:
Quote:
Citation:

Hibernate: delete from CARAC_PRODUIT where numP=? and valeur=? and numCarac=?
Hibernate: insert into CARAC_PRODUIT (numP, valeur, numCarac) values (?, ?, ?)
Hibernate: insert into CARAC_PRODUIT (numP, valeur, numCarac) values (?, ?, ?)
Hibernate: insert into CARAC_PRODUIT (numP, valeur, numCarac) values (?, ?, ?)
Hibernate: insert into CARAC_PRODUIT (numP, valeur, numCarac) values (?, ?, ?)
Hibernate: insert into CARAC_PRODUIT (numP, valeur, numCarac) values (?, ?, ?)
Hibernate: insert into CARAC_PRODUIT (numP, valeur, numCarac) values (?, ?, ?)
Hibernate: insert into CARAC_PRODUIT (numP, valeur, numCarac) values (?, ?, ?)

pourquoi ce delete et les insert?????


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 10, 2005 7:33 am 
Newbie

Joined: Wed Aug 10, 2005 6:26 am
Posts: 8
voici les log DEBUG

Quote:
13:29:51,342 DEBUG AbstractFlushingEventListener:167 - Flushing entities and processing referenced collections
13:29:51,342 DEBUG Collections:140 - Collection found: [dao.Produit.listComment#1], was: [dao.Produit.listComment#1] (uninitialized)
13:29:51,358 DEBUG Collections:140 - Collection found: [dao.Produit.listCaract#1], was: [dao.Produit.listCaract#1] (uninitialized)
13:29:51,358 DEBUG Collections:140 - Collection found: [dao.Categorie.listCaract#1], was: [dao.Categorie.listCaract#1] (uninitialized)
13:29:51,358 DEBUG AbstractFlushingEventListener:203 - Processing unreferenced collections
13:29:51,358 DEBUG AbstractFlushingEventListener:217 - Scheduling collection removes/(re)creates/updates
13:29:51,373 DEBUG AbstractFlushingEventListener:79 - Flushed: 0 insertions, 0 updates, 0 deletions to 4 objects
13:29:51,373 DEBUG AbstractFlushingEventListener:85 - Flushed: 0 (re)creations, 0 updates, 0 removals to 3 collections
13:29:51,373 DEBUG Printer:83 - listing entities:
13:29:51,373 DEBUG Printer:90 - dao.Produit{listComment=<uninitialized>, prixP=300, stockP=-40, refFourProduit=4545, constructeur=dao.Constructeur#3, promo=0, listCaract=<uninitialized>, nbConsultation=0, designationP=La puissance ? l'?tat pur, categorie=dao.Categorie#1, etatP=dao.Etat#3, libelleP=P4 3GHz, numProduit=1}
13:29:51,373 DEBUG Printer:90 - dao.Categorie{listCaract=<uninitialized>, numCategorie=1, libelleCategorie=PROCESSEUR}
13:29:51,373 DEBUG Printer:90 - dao.Constructeur{siteWeb=http://intel.com, nomConstructeur=INTEL, numConstructeur=3}
13:29:51,373 DEBUG Printer:90 - dao.Etat{libelleEtat=RUPTURE, numEtat=3}
13:29:51,373 DEBUG AbstractFlushingEventListener:267 - executing flush
13:29:51,373 DEBUG AbstractFlushingEventListener:294 - post flush
13:29:51,373 DEBUG JDBCTransaction:46 - begin
13:29:51,373 DEBUG JDBCTransaction:50 - current autocommit status: true
13:29:51,373 DEBUG JDBCTransaction:52 - disabling autocommit
13:29:51,373 DEBUG DefaultLoadEventListener:143 - loading entity: [dao.Produit#1]
13:29:51,389 DEBUG DefaultLoadEventListener:208 - entity found in session cache
13:29:51,389 DEBUG DefaultInitializeCollectionEventListener:42 - initializing collection [dao.Produit.listCaract#1]
13:29:51,389 DEBUG DefaultInitializeCollectionEventListener:47 - checking second-level cache
13:29:51,389 DEBUG DefaultInitializeCollectionEventListener:59 - collection not cached
13:29:51,389 DEBUG Loader:1426 - loading collection: [dao.Produit.listCaract#1]
13:29:51,389 DEBUG AbstractBatcher:290 - about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
13:29:51,389 DEBUG SQL:324 - select listcaract0_.numP as numP0_, listcaract0_.valeur as valeur0_, listcaract0_.numCarac as numCarac0_ from CARAC_PRODUIT listcaract0_ where listcaract0_.numP=?
Hibernate: select listcaract0_.numP as numP0_, listcaract0_.valeur as valeur0_, listcaract0_.numCarac as numCarac0_ from CARAC_PRODUIT listcaract0_ where listcaract0_.numP=?
13:29:51,389 DEBUG AbstractBatcher:378 - preparing statement
13:29:51,389 DEBUG AbstractBatcher:306 - about to open ResultSet (open ResultSets: 0, globally: 0)
13:29:51,389 DEBUG Loader:718 - result set contains (possibly empty) collection: [dao.Produit.listCaract#1]
13:29:51,389 DEBUG CollectionLoadContext:85 - uninitialized collection: initializing
13:29:51,389 DEBUG Loader:405 - processing result set
13:29:51,389 DEBUG Loader:410 - result set row: 0
13:29:51,405 DEBUG Loader:828 - result row:
13:29:51,405 DEBUG Loader:654 - found row of collection: [dao.Produit.listCaract#1]
13:29:51,405 DEBUG CollectionLoadContext:112 - reading row
13:29:51,405 DEBUG DefaultLoadEventListener:143 - loading entity: [dao.Caracteristique#10]
13:29:51,405 DEBUG DefaultLoadEventListener:216 - creating new proxy for entity
13:29:51,420 DEBUG Loader:410 - result set row: 1
13:29:51,420 DEBUG Loader:828 - result row:
13:29:51,420 DEBUG Loader:654 - found row of collection: [dao.Produit.listCaract#1]
13:29:51,420 DEBUG CollectionLoadContext:112 - reading row
13:29:51,420 DEBUG DefaultLoadEventListener:143 - loading entity: [dao.Caracteristique#11]
13:29:51,420 DEBUG DefaultLoadEventListener:216 - creating new proxy for entity
13:29:51,436 DEBUG Loader:410 - result set row: 2
13:29:51,436 DEBUG Loader:828 - result row:
13:29:51,436 DEBUG Loader:654 - found row of collection: [dao.Produit.listCaract#1]
13:29:51,436 DEBUG CollectionLoadContext:112 - reading row
13:29:51,436 DEBUG DefaultLoadEventListener:143 - loading entity: [dao.Caracteristique#12]
13:29:51,436 DEBUG DefaultLoadEventListener:216 - creating new proxy for entity
13:29:51,436 DEBUG Loader:410 - result set row: 3
13:29:51,436 DEBUG Loader:828 - result row:
13:29:51,436 DEBUG Loader:654 - found row of collection: [dao.Produit.listCaract#1]
13:29:51,436 DEBUG CollectionLoadContext:112 - reading row
13:29:51,436 DEBUG DefaultLoadEventListener:143 - loading entity: [dao.Caracteristique#13]
13:29:51,451 DEBUG DefaultLoadEventListener:216 - creating new proxy for entity
13:29:51,451 DEBUG Loader:410 - result set row: 4
13:29:51,451 DEBUG Loader:828 - result row:
13:29:51,451 DEBUG Loader:654 - found row of collection: [dao.Produit.listCaract#1]
13:29:51,451 DEBUG CollectionLoadContext:112 - reading row
13:29:51,451 DEBUG DefaultLoadEventListener:143 - loading entity: [dao.Caracteristique#14]
13:29:51,451 DEBUG DefaultLoadEventListener:216 - creating new proxy for entity
13:29:51,451 DEBUG Loader:410 - result set row: 5
13:29:51,451 DEBUG Loader:828 - result row:
13:29:51,451 DEBUG Loader:654 - found row of collection: [dao.Produit.listCaract#1]
13:29:51,451 DEBUG CollectionLoadContext:112 - reading row
13:29:51,467 DEBUG DefaultLoadEventListener:143 - loading entity: [dao.Caracteristique#15]
13:29:51,467 DEBUG DefaultLoadEventListener:216 - creating new proxy for entity
13:29:51,467 DEBUG Loader:410 - result set row: 6
13:29:51,467 DEBUG Loader:828 - result row:
13:29:51,467 DEBUG Loader:654 - found row of collection: [dao.Produit.listCaract#1]
13:29:51,467 DEBUG CollectionLoadContext:112 - reading row
13:29:51,467 DEBUG DefaultLoadEventListener:143 - loading entity: [dao.Caracteristique#28]
13:29:51,483 DEBUG DefaultLoadEventListener:216 - creating new proxy for entity
13:29:51,483 DEBUG Loader:429 - done processing result set (7 rows)
13:29:51,483 DEBUG AbstractBatcher:313 - about to close ResultSet (open ResultSets: 1, globally: 1)
13:29:51,483 DEBUG AbstractBatcher:298 - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
13:29:51,483 DEBUG AbstractBatcher:416 - closing statement
13:29:51,483 DEBUG CollectionLoadContext:262 - 1 collections were found in result set for role: dao.Produit.listCaract
13:29:51,483 DEBUG CollectionLoadContext:206 - collection fully initialized: [dao.Produit.listCaract#1]
13:29:51,483 DEBUG CollectionLoadContext:272 - 1 collections initialized for role: dao.Produit.listCaract
13:29:51,483 DEBUG PersistenceContext:789 - initializing non-lazy collections
13:29:51,483 DEBUG Loader:1450 - done loading collection
13:29:51,498 DEBUG DefaultInitializeCollectionEventListener:61 - collection initialized
13:29:51,498 DEBUG SessionImpl:639 - initializing proxy: [dao.Caracteristique#28]
13:29:51,498 DEBUG DefaultLoadEventListener:290 - attempting to resolve: [dao.Caracteristique#28]
13:29:51,498 DEBUG DefaultLoadEventListener:326 - object not resolved in any cache: [dao.Caracteristique#28]
13:29:51,498 DEBUG BasicEntityPersister:2467 - Materializing entity: [dao.Caracteristique#28]
13:29:51,498 DEBUG Loader:1340 - loading entity: [dao.Caracteristique#28]
13:29:51,498 DEBUG AbstractBatcher:290 - about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
13:29:51,498 DEBUG SQL:324 - select caracteris0_.numCaracteristique as numCarac1_0_, caracteris0_.libelleCarac as libelleC2_10_0_ from CARACTERISTIQUE caracteris0_ where caracteris0_.numCaracteristique=?
Hibernate: select caracteris0_.numCaracteristique as numCarac1_0_, caracteris0_.libelleCarac as libelleC2_10_0_ from CARACTERISTIQUE caracteris0_ where caracteris0_.numCaracteristique=?
13:29:51,498 DEBUG AbstractBatcher:378 - preparing statement
13:29:51,514 DEBUG AbstractBatcher:306 - about to open ResultSet (open ResultSets: 0, globally: 0)
13:29:51,514 DEBUG Loader:405 - processing result set
13:29:51,514 DEBUG Loader:410 - result set row: 0
13:29:51,514 DEBUG Loader:828 - result row: EntityKey[dao.Caracteristique#28]
13:29:51,514 DEBUG Loader:978 - Initializing object from ResultSet: [dao.Caracteristique#28]
13:29:51,514 DEBUG BasicEntityPersister:1651 - Hydrating entity: [dao.Caracteristique#28]
13:29:51,514 DEBUG Loader:429 - done processing result set (1 rows)
13:29:51,514 DEBUG AbstractBatcher:313 - about to close ResultSet (open ResultSets: 1, globally: 1)
13:29:51,514 DEBUG AbstractBatcher:298 - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
13:29:51,514 DEBUG AbstractBatcher:416 - closing statement
13:29:51,514 DEBUG Loader:528 - total objects hydrated: 1
13:29:51,530 DEBUG TwoPhaseLoad:96 - resolving associations for [dao.Caracteristique#28]
13:29:51,530 DEBUG TwoPhaseLoad:167 - done materializing entity [dao.Caracteristique#28]
13:29:51,530 DEBUG PersistenceContext:789 - initializing non-lazy collections
13:29:51,530 DEBUG Loader:1368 - done entity load
13:29:51,530 DEBUG SessionImpl:639 - initializing proxy: [dao.Caracteristique#12]
13:29:51,530 DEBUG DefaultLoadEventListener:290 - attempting to resolve: [dao.Caracteristique#12]
13:29:51,530 DEBUG DefaultLoadEventListener:326 - object not resolved in any cache: [dao.Caracteristique#12]
13:29:51,530 DEBUG BasicEntityPersister:2467 - Materializing entity: [dao.Caracteristique#12]
13:29:51,530 DEBUG Loader:1340 - loading entity: [dao.Caracteristique#12]
13:29:51,530 DEBUG AbstractBatcher:290 - about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
13:29:51,530 DEBUG SQL:324 - select caracteris0_.numCaracteristique as numCarac1_0_, caracteris0_.libelleCarac as libelleC2_10_0_ from CARACTERISTIQUE caracteris0_ where caracteris0_.numCaracteristique=?
Hibernate: select caracteris0_.numCaracteristique as numCarac1_0_, caracteris0_.libelleCarac as libelleC2_10_0_ from CARACTERISTIQUE caracteris0_ where caracteris0_.numCaracteristique=?
13:29:51,530 DEBUG AbstractBatcher:378 - preparing statement
13:29:51,545 DEBUG AbstractBatcher:306 - about to open ResultSet (open ResultSets: 0, globally: 0)
13:29:51,545 DEBUG Loader:405 - processing result set
13:29:51,545 DEBUG Loader:410 - result set row: 0
13:29:51,545 DEBUG Loader:828 - result row: EntityKey[dao.Caracteristique#12]
13:29:51,545 DEBUG Loader:978 - Initializing object from ResultSet: [dao.Caracteristique#12]
13:29:51,545 DEBUG BasicEntityPersister:1651 - Hydrating entity: [dao.Caracteristique#12]
13:29:51,545 DEBUG Loader:429 - done processing result set (1 rows)
13:29:51,545 DEBUG AbstractBatcher:313 - about to close ResultSet (open ResultSets: 1, globally: 1)
13:29:51,545 DEBUG AbstractBatcher:298 - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
13:29:51,545 DEBUG AbstractBatcher:416 - closing statement
13:29:51,561 DEBUG Loader:528 - total objects hydrated: 1
13:29:51,561 DEBUG TwoPhaseLoad:96 - resolving associations for [dao.Caracteristique#12]
13:29:51,561 DEBUG TwoPhaseLoad:167 - done materializing entity [dao.Caracteristique#12]
13:29:51,561 DEBUG PersistenceContext:789 - initializing non-lazy collections
13:29:51,561 DEBUG Loader:1368 - done entity load
13:29:51,561 DEBUG SessionImpl:639 - initializing proxy: [dao.Caracteristique#13]
13:29:51,561 DEBUG DefaultLoadEventListener:290 - attempting to resolve: [dao.Caracteristique#13]
13:29:51,561 DEBUG DefaultLoadEventListener:326 - object not resolved in any cache: [dao.Caracteristique#13]
13:29:51,561 DEBUG BasicEntityPersister:2467 - Materializing entity: [dao.Caracteristique#13]
13:29:51,576 DEBUG Loader:1340 - loading entity: [dao.Caracteristique#13]
13:29:51,576 DEBUG AbstractBatcher:290 - about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
13:29:51,576 DEBUG SQL:324 - select caracteris0_.numCaracteristique as numCarac1_0_, caracteris0_.libelleCarac as libelleC2_10_0_ from CARACTERISTIQUE caracteris0_ where caracteris0_.numCaracteristique=?
Hibernate: select caracteris0_.numCaracteristique as numCarac1_0_, caracteris0_.libelleCarac as libelleC2_10_0_ from CARACTERISTIQUE caracteris0_ where caracteris0_.numCaracteristique=?
13:29:51,592 DEBUG AbstractBatcher:378 - preparing statement
13:29:51,592 DEBUG AbstractBatcher:306 - about to open ResultSet (open ResultSets: 0, globally: 0)
13:29:51,592 DEBUG Loader:405 - processing result set
13:29:51,592 DEBUG Loader:410 - result set row: 0
13:29:51,592 DEBUG Loader:828 - result row: EntityKey[dao.Caracteristique#13]
13:29:51,592 DEBUG Loader:978 - Initializing object from ResultSet: [dao.Caracteristique#13]
13:29:51,592 DEBUG BasicEntityPersister:1651 - Hydrating entity: [dao.Caracteristique#13]
13:29:51,592 DEBUG Loader:429 - done processing result set (1 rows)
13:29:51,592 DEBUG AbstractBatcher:313 - about to close ResultSet (open ResultSets: 1, globally: 1)
13:29:51,592 DEBUG AbstractBatcher:298 - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
13:29:51,608 DEBUG AbstractBatcher:416 - closing statement
13:29:51,608 DEBUG Loader:528 - total objects hydrated: 1
13:29:51,608 DEBUG TwoPhaseLoad:96 - resolving associations for [dao.Caracteristique#13]
13:29:51,608 DEBUG TwoPhaseLoad:167 - done materializing entity [dao.Caracteristique#13]
13:29:51,608 DEBUG PersistenceContext:789 - initializing non-lazy collections
13:29:51,608 DEBUG Loader:1368 - done entity load
13:29:51,608 DEBUG SessionImpl:639 - initializing proxy: [dao.Caracteristique#14]
13:29:51,608 DEBUG DefaultLoadEventListener:290 - attempting to resolve: [dao.Caracteristique#14]
13:29:51,608 DEBUG DefaultLoadEventListener:326 - object not resolved in any cache: [dao.Caracteristique#14]
13:29:51,608 DEBUG BasicEntityPersister:2467 - Materializing entity: [dao.Caracteristique#14]
13:29:51,608 DEBUG Loader:1340 - loading entity: [dao.Caracteristique#14]
13:29:51,608 DEBUG AbstractBatcher:290 - about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
13:29:51,608 DEBUG SQL:324 - select caracteris0_.numCaracteristique as numCarac1_0_, caracteris0_.libelleCarac as libelleC2_10_0_ from CARACTERISTIQUE caracteris0_ where caracteris0_.numCaracteristique=?
Hibernate: select caracteris0_.numCaracteristique as numCarac1_0_, caracteris0_.libelleCarac as libelleC2_10_0_ from CARACTERISTIQUE caracteris0_ where caracteris0_.numCaracteristique=?
13:29:51,608 DEBUG AbstractBatcher:378 - preparing statement
13:29:51,623 DEBUG AbstractBatcher:306 - about to open ResultSet (open ResultSets: 0, globally: 0)
13:29:51,623 DEBUG Loader:405 - processing result set
13:29:51,623 DEBUG Loader:410 - result set row: 0
13:29:51,623 DEBUG Loader:828 - result row: EntityKey[dao.Caracteristique#14]
13:29:51,623 DEBUG Loader:978 - Initializing object from ResultSet: [dao.Caracteristique#14]
13:29:51,623 DEBUG BasicEntityPersister:1651 - Hydrating entity: [dao.Caracteristique#14]
13:29:51,623 DEBUG Loader:429 - done processing result set (1 rows)
13:29:51,623 DEBUG AbstractBatcher:313 - about to close ResultSet (open ResultSets: 1, globally: 1)
13:29:51,623 DEBUG AbstractBatcher:298 - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
13:29:51,639 DEBUG AbstractBatcher:416 - closing statement
13:29:51,639 DEBUG Loader:528 - total objects hydrated: 1
13:29:51,639 DEBUG TwoPhaseLoad:96 - resolving associations for [dao.Caracteristique#14]
13:29:51,639 DEBUG TwoPhaseLoad:167 - done materializing entity [dao.Caracteristique#14]
13:29:51,639 DEBUG PersistenceContext:789 - initializing non-lazy collections
13:29:51,639 DEBUG Loader:1368 - done entity load
13:29:51,639 DEBUG SessionImpl:639 - initializing proxy: [dao.Caracteristique#15]
13:29:51,639 DEBUG DefaultLoadEventListener:290 - attempting to resolve: [dao.Caracteristique#15]
13:29:51,639 DEBUG DefaultLoadEventListener:326 - object not resolved in any cache: [dao.Caracteristique#15]
13:29:51,639 DEBUG BasicEntityPersister:2467 - Materializing entity: [dao.Caracteristique#15]
13:29:51,639 DEBUG Loader:1340 - loading entity: [dao.Caracteristique#15]
13:29:51,639 DEBUG AbstractBatcher:290 - about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
13:29:51,639 DEBUG SQL:324 - select caracteris0_.numCaracteristique as numCarac1_0_, caracteris0_.libelleCarac as libelleC2_10_0_ from CARACTERISTIQUE caracteris0_ where caracteris0_.numCaracteristique=?
Hibernate: select caracteris0_.numCaracteristique as numCarac1_0_, caracteris0_.libelleCarac as libelleC2_10_0_ from CARACTERISTIQUE caracteris0_ where caracteris0_.numCaracteristique=?
13:29:51,655 DEBUG AbstractBatcher:378 - preparing statement
13:29:51,655 DEBUG AbstractBatcher:306 - about to open ResultSet (open ResultSets: 0, globally: 0)
13:29:51,655 DEBUG Loader:405 - processing result set
13:29:51,655 DEBUG Loader:410 - result set row: 0
13:29:51,655 DEBUG Loader:828 - result row: EntityKey[dao.Caracteristique#15]
13:29:51,655 DEBUG Loader:978 - Initializing object from ResultSet: [dao.Caracteristique#15]
13:29:51,655 DEBUG BasicEntityPersister:1651 - Hydrating entity: [dao.Caracteristique#15]
13:29:51,655 DEBUG Loader:429 - done processing result set (1 rows)
13:29:51,655 DEBUG AbstractBatcher:313 - about to close ResultSet (open ResultSets: 1, globally: 1)
13:29:51,670 DEBUG AbstractBatcher:298 - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
13:29:51,670 DEBUG AbstractBatcher:416 - closing statement
13:29:51,670 DEBUG Loader:528 - total objects hydrated: 1
13:29:51,670 DEBUG TwoPhaseLoad:96 - resolving associations for [dao.Caracteristique#15]
13:29:51,670 DEBUG TwoPhaseLoad:167 - done materializing entity [dao.Caracteristique#15]
13:29:51,670 DEBUG PersistenceContext:789 - initializing non-lazy collections
13:29:51,670 DEBUG Loader:1368 - done entity load
13:29:51,670 DEBUG SessionImpl:639 - initializing proxy: [dao.Caracteristique#11]
13:29:51,670 DEBUG DefaultLoadEventListener:290 - attempting to resolve: [dao.Caracteristique#11]
13:29:51,670 DEBUG DefaultLoadEventListener:326 - object not resolved in any cache: [dao.Caracteristique#11]
13:29:51,670 DEBUG BasicEntityPersister:2467 - Materializing entity: [dao.Caracteristique#11]
13:29:51,670 DEBUG Loader:1340 - loading entity: [dao.Caracteristique#11]
13:29:51,670 DEBUG AbstractBatcher:290 - about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
13:29:51,686 DEBUG SQL:324 - select caracteris0_.numCaracteristique as numCarac1_0_, caracteris0_.libelleCarac as libelleC2_10_0_ from CARACTERISTIQUE caracteris0_ where caracteris0_.numCaracteristique=?
Hibernate: select caracteris0_.numCaracteristique as numCarac1_0_, caracteris0_.libelleCarac as libelleC2_10_0_ from CARACTERISTIQUE caracteris0_ where caracteris0_.numCaracteristique=?
13:29:51,686 DEBUG AbstractBatcher:378 - preparing statement
13:29:51,686 DEBUG AbstractBatcher:306 - about to open ResultSet (open ResultSets: 0, globally: 0)
13:29:51,686 DEBUG Loader:405 - processing result set
13:29:51,686 DEBUG Loader:410 - result set row: 0
13:29:51,701 DEBUG Loader:828 - result row: EntityKey[dao.Caracteristique#11]
13:29:51,701 DEBUG Loader:978 - Initializing object from ResultSet: [dao.Caracteristique#11]
13:29:51,701 DEBUG BasicEntityPersister:1651 - Hydrating entity: [dao.Caracteristique#11]
13:29:51,701 DEBUG Loader:429 - done processing result set (1 rows)
13:29:51,701 DEBUG AbstractBatcher:313 - about to close ResultSet (open ResultSets: 1, globally: 1)
13:29:51,701 DEBUG AbstractBatcher:298 - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
13:29:51,701 DEBUG AbstractBatcher:416 - closing statement
13:29:51,701 DEBUG Loader:528 - total objects hydrated: 1
13:29:51,701 DEBUG TwoPhaseLoad:96 - resolving associations for [dao.Caracteristique#11]
13:29:51,717 DEBUG TwoPhaseLoad:167 - done materializing entity [dao.Caracteristique#11]
13:29:51,717 DEBUG PersistenceContext:789 - initializing non-lazy collections
13:29:51,717 DEBUG Loader:1368 - done entity load
13:29:51,717 DEBUG SessionImpl:639 - initializing proxy: [dao.Caracteristique#10]
13:29:51,717 DEBUG DefaultLoadEventListener:290 - attempting to resolve: [dao.Caracteristique#10]
13:29:51,717 DEBUG DefaultLoadEventListener:326 - object not resolved in any cache: [dao.Caracteristique#10]
13:29:51,717 DEBUG BasicEntityPersister:2467 - Materializing entity: [dao.Caracteristique#10]
13:29:51,717 DEBUG Loader:1340 - loading entity: [dao.Caracteristique#10]
13:29:51,717 DEBUG AbstractBatcher:290 - about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
13:29:51,717 DEBUG SQL:324 - select caracteris0_.numCaracteristique as numCarac1_0_, caracteris0_.libelleCarac as libelleC2_10_0_ from CARACTERISTIQUE caracteris0_ where caracteris0_.numCaracteristique=?
Hibernate: select caracteris0_.numCaracteristique as numCarac1_0_, caracteris0_.libelleCarac as libelleC2_10_0_ from CARACTERISTIQUE caracteris0_ where caracteris0_.numCaracteristique=?
13:29:51,717 DEBUG AbstractBatcher:378 - preparing statement
13:29:51,733 DEBUG AbstractBatcher:306 - about to open ResultSet (open ResultSets: 0, globally: 0)
13:29:51,733 DEBUG Loader:405 - processing result set
13:29:51,733 DEBUG Loader:410 - result set row: 0
13:29:51,733 DEBUG Loader:828 - result row: EntityKey[dao.Caracteristique#10]
13:29:51,733 DEBUG Loader:978 - Initializing object from ResultSet: [dao.Caracteristique#10]
13:29:51,733 DEBUG BasicEntityPersister:1651 - Hydrating entity: [dao.Caracteristique#10]
13:29:51,733 DEBUG Loader:429 - done processing result set (1 rows)
13:29:51,733 DEBUG AbstractBatcher:313 - about to close ResultSet (open ResultSets: 1, globally: 1)
13:29:51,733 DEBUG AbstractBatcher:298 - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
13:29:51,733 DEBUG AbstractBatcher:416 - closing statement
13:29:51,748 DEBUG Loader:528 - total objects hydrated: 1
13:29:51,748 DEBUG TwoPhaseLoad:96 - resolving associations for [dao.Caracteristique#10]
13:29:51,748 DEBUG TwoPhaseLoad:167 - done materializing entity [dao.Caracteristique#10]
13:29:51,748 DEBUG PersistenceContext:789 - initializing non-lazy collections
13:29:51,748 DEBUG Loader:1368 - done entity load
13:29:51,748 DEBUG JDBCTransaction:83 - commit
13:29:51,748 DEBUG JDBCContext:278 - before transaction completion
13:29:51,748 DEBUG SessionImpl:372 - before transaction completion
13:29:51,748 DEBUG JDBCTransaction:173 - re-enabling autocommit
13:29:51,748 DEBUG JDBCTransaction:96 - committed JDBC Connection
13:29:51,748 DEBUG JDBCContext:283 - after transaction completion
13:29:51,748 DEBUG SessionImpl:403 - after transaction completion
13:29:51,764 DEBUG AbstractFlushingEventListener:52 - flushing session
13:29:51,764 DEBUG AbstractFlushingEventListener:102 - processing flush-time cascades
13:29:51,764 DEBUG AbstractFlushingEventListener:150 - dirty checking collections
13:29:51,764 DEBUG CollectionEntry:115 - Collection dirty: [dao.Produit.listCaract#1]
13:29:51,764 DEBUG AbstractFlushingEventListener:167 - Flushing entities and processing referenced collections
13:29:51,764 DEBUG Collections:140 - Collection found: [dao.Produit.listComment#1], was: [dao.Produit.listComment#1] (uninitialized)
13:29:51,764 DEBUG Collections:140 - Collection found: [dao.Produit.listCaract#1], was: [dao.Produit.listCaract#1] (initialized)
13:29:51,764 DEBUG Collections:140 - Collection found: [dao.Categorie.listCaract#1], was: [dao.Categorie.listCaract#1] (uninitialized)
13:29:51,764 DEBUG AbstractFlushingEventListener:203 - Processing unreferenced collections
13:29:51,764 DEBUG AbstractFlushingEventListener:217 - Scheduling collection removes/(re)creates/updates
13:29:51,764 DEBUG AbstractFlushingEventListener:79 - Flushed: 0 insertions, 0 updates, 0 deletions to 11 objects
13:29:51,764 DEBUG AbstractFlushingEventListener:85 - Flushed: 0 (re)creations, 1 updates, 0 removals to 3 collections
13:29:51,764 DEBUG Printer:83 - listing entities:
13:29:51,780 DEBUG Printer:90 - dao.Caracteristique{numCarac=10, libelleCarac=Support du socket}
13:29:51,780 DEBUG Printer:90 - dao.Caracteristique{numCarac=14, libelleCarac=Taille Cache L1}
13:29:51,780 DEBUG Printer:90 - dao.Produit{listComment=<uninitialized>, prixP=300, stockP=-40, refFourProduit=4545, constructeur=dao.Constructeur#3, promo=0, listCaract=[component[valeur,carac]{valeur=oui, carac=dao.Caracteristique#28}, component[valeur,carac]{valeur=0,13, carac=dao.Caracteristique#12}, component[valeur,carac]{valeur=P4E, carac=dao.Caracteristique#13}, component[valeur,carac]{valeur=512 ko, carac=dao.Caracteristique#14}, component[valeur,carac]{valeur=2 mo, carac=dao.Caracteristique#15}, component[valeur,carac]{valeur=3000, carac=dao.Caracteristique#11}, component[valeur,carac]{valeur=S748, carac=dao.Caracteristique#10}], nbConsultation=0, designationP=La puissance ? l'?tat pur, categorie=dao.Categorie#1, etatP=dao.Etat#3, libelleP=P4 3GHz, numProduit=1}
13:29:51,780 DEBUG Printer:90 - dao.Etat{libelleEtat=RUPTURE, numEtat=3}
13:29:51,780 DEBUG Printer:90 - dao.Caracteristique{numCarac=12, libelleCarac=Finesse de gravure}
13:29:51,780 DEBUG Printer:90 - dao.Caracteristique{numCarac=15, libelleCarac=Taille Cache L2}
13:29:51,780 DEBUG Printer:90 - dao.Constructeur{siteWeb=http://intel.com, nomConstructeur=INTEL, numConstructeur=3}
13:29:51,780 DEBUG Printer:90 - dao.Categorie{listCaract=<uninitialized>, numCategorie=1, libelleCategorie=PROCESSEUR}
13:29:51,780 DEBUG Printer:90 - dao.Caracteristique{numCarac=13, libelleCarac=Architecture}
13:29:51,780 DEBUG Printer:90 - dao.Caracteristique{numCarac=11, libelleCarac=Fréquence [MHz]}
13:29:51,780 DEBUG Printer:90 - dao.Caracteristique{numCarac=28, libelleCarac=MMX}



// POURQUOI CETTE SUPPRESSION




13:29:51,780 DEBUG AbstractFlushingEventListener:267 - executing flush
13:29:51,780 DEBUG AbstractCollectionPersister:956 - Deleting rows of collection: [dao.Produit.listCaract#1]
13:29:51,780 DEBUG AbstractBatcher:290 - about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
13:29:51,780 DEBUG SQL:324 - delete from CARAC_PRODUIT where numP=? and valeur=? and numCarac=?
Hibernate: delete from CARAC_PRODUIT where numP=? and valeur=? and numCarac=?
13:29:51,795 DEBUG AbstractBatcher:378 - preparing statement
13:29:51,795 DEBUG AbstractBatcher:27 - Adding to batch
13:29:51,795 DEBUG AbstractBatcher:27 - Adding to batch
13:29:51,795 DEBUG AbstractBatcher:27 - Adding to batch
13:29:51,795 DEBUG AbstractBatcher:27 - Adding to batch
13:29:51,795 DEBUG AbstractBatcher:27 - Adding to batch
13:29:51,795 DEBUG AbstractBatcher:27 - Adding to batch
13:29:51,795 DEBUG AbstractBatcher:27 - Adding to batch
13:29:51,795 DEBUG AbstractCollectionPersister:1007 - done deleting collection rows: 7 deleted
13:29:51,811 DEBUG AbstractCollectionPersister:1035 - Inserting rows of collection: [dao.Produit.listCaract#1]
13:29:51,811 DEBUG AbstractBatcher:54 - Executing batch size: 7
13:29:51,936 DEBUG AbstractBatcher:298 - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
13:29:51,936 DEBUG AbstractBatcher:416 - closing statement
13:29:51,936 DEBUG AbstractBatcher:290 - about to open PreparedStatement (open PreparedStatements: 0, globally: 0)




// Pourquoi ces insertion??????

13:29:51,936 DEBUG SQL:324 - insert into CARAC_PRODUIT (numP, valeur, numCarac) values (?, ?, ?)
Hibernate: insert into CARAC_PRODUIT (numP, valeur, numCarac) values (?, ?, ?)
13:29:51,951 DEBUG AbstractBatcher:378 - preparing statement
13:29:52,045 DEBUG AbstractBatcher:27 - Adding to batch
13:29:52,045 DEBUG AbstractBatcher:154 - reusing prepared statement
13:29:52,045 DEBUG SQL:324 - insert into CARAC_PRODUIT (numP, valeur, numCarac) values (?, ?, ?)
Hibernate: insert into CARAC_PRODUIT (numP, valeur, numCarac) values (?, ?, ?)
13:29:52,045 DEBUG AbstractBatcher:27 - Adding to batch
13:29:52,045 DEBUG AbstractBatcher:154 - reusing prepared statement
13:29:52,045 DEBUG SQL:324 - insert into CARAC_PRODUIT (numP, valeur, numCarac) values (?, ?, ?)
Hibernate: insert into CARAC_PRODUIT (numP, valeur, numCarac) values (?, ?, ?)
13:29:52,045 DEBUG AbstractBatcher:27 - Adding to batch
13:29:52,045 DEBUG AbstractBatcher:154 - reusing prepared statement
13:29:52,045 DEBUG SQL:324 - insert into CARAC_PRODUIT (numP, valeur, numCarac) values (?, ?, ?)
Hibernate: insert into CARAC_PRODUIT (numP, valeur, numCarac) values (?, ?, ?)
13:29:52,045 DEBUG AbstractBatcher:27 - Adding to batch
13:29:52,045 DEBUG AbstractBatcher:154 - reusing prepared statement
13:29:52,045 DEBUG SQL:324 - insert into CARAC_PRODUIT (numP, valeur, numCarac) values (?, ?, ?)
Hibernate: insert into CARAC_PRODUIT (numP, valeur, numCarac) values (?, ?, ?)
13:29:52,045 DEBUG AbstractBatcher:27 - Adding to batch
13:29:52,045 DEBUG AbstractBatcher:154 - reusing prepared statement
13:29:52,061 DEBUG SQL:324 - insert into CARAC_PRODUIT (numP, valeur, numCarac) values (?, ?, ?)
Hibernate: insert into CARAC_PRODUIT (numP, valeur, numCarac) values (?, ?, ?)
13:29:52,061 DEBUG AbstractBatcher:27 - Adding to batch
13:29:52,061 DEBUG AbstractBatcher:154 - reusing prepared statement
13:29:52,061 DEBUG SQL:324 - insert into CARAC_PRODUIT (numP, valeur, numCarac) values (?, ?, ?)
Hibernate: insert into CARAC_PRODUIT (numP, valeur, numCarac) values (?, ?, ?)
13:29:52,061 DEBUG AbstractBatcher:27 - Adding to batch
13:29:52,061 DEBUG AbstractCollectionPersister:1079 - done inserting rows: 7 inserted
13:29:52,076 DEBUG AbstractBatcher:54 - Executing batch size: 7
13:29:52,201 DEBUG AbstractBatcher:298 - about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
13:29:52,201 DEBUG AbstractBatcher:416 - closing statement
13:29:52,217 DEBUG AbstractFlushingEventListener:294 - post flush

13:29:52,233 DEBUG SessionImpl:269 - closing session
13:29:52,233 DEBUG ConnectionManager:317 - closing JDBC connection [ (open PreparedStatements: 0, globally: 0) (open ResultSets: 0, globally: 0)]
13:29:52,467 DEBUG JDBCContext:283 - after transaction completion
13:29:52,483 DEBUG SessionImpl:403 - after transaction completion


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 10, 2005 1:14 pm 
Expert
Expert

Joined: Thu Sep 04, 2003 8:23 am
Posts: 368
La plupart du tems les insert/delete sont liés à des méthodes equals/hashCode incorrectes.

Je ne puis te l'affirmer car j'ai un peu oublié ce que j'avais fait mais j'avais eu à une époque une erreur dans le même style que toi que je n'arrivais pas à corriger même avec des méthodes equals/hashCode correctes. Je crois que c'est lorsque l'on modifie un component dans un set de component, hibernate fait un delete puis insert car il ne peut retrouver ce component via son id

Pour résoudre ce problème j'avais utilisé un idbag (cela fait une colonne en plus qui sert d'id et qui permet à hibernate de retrouver les objets qu'il a chargé et de voir qu'ils n'ont pas été modifiés).

Dans ton cas, je pense que le premier prolbème vient d'un couple hashCode/equals incorrect

_________________
Seb
(Please don't forget to give credits if you found this answer useful :)


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.