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.  [ 1 post ] 
Author Message
 Post subject: [EJB3][Postgres]update et insertions en batch
PostPosted: Tue Mar 20, 2007 12:48 pm 
Newbie

Joined: Thu Nov 23, 2006 12:27 pm
Posts: 6
Bonjour,
j'utilise hibernate 3.2.0cr2 via le container ejb3 standalone de jboss. La base de données est Postgresql 8.1 .
Lorsque j'essaie de configurer la propriété hibernate.jdbc.batch_size en l'initialisant à 20 par exemple, celle ci ne semble pas être prise en compte. J'ai une entité account avec une relation one to tone avec une entite contact et lors de la mise a jour et de l insertion, le batch_size est à 1:
J 'ai realise la maj avec un merge.

Code:
17:33:09,300 DEBUG [AbstractBatcher] about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
17:33:09,300 DEBUG [ConnectionManager] opening JDBC connection
17:33:09,300 DEBUG [SQL]
    /* insert fr.ccip.gefi.domain.Contact
        */ insert
        into
            Contact
            (name, firstname, address, zip, city, country, phoneNumber, faxNumber, email, DTYPE, id)
        values
            (?, ?, ?, ?, ?, ?, ?, ?, ?, 'Contact', ?)
Hibernate:
    /* insert fr.ccip.gefi.domain.Contact
        */ insert
        into
            Contact
            (name, firstname, address, zip, city, country, phoneNumber, faxNumber, email, DTYPE, id)
        values
            (?, ?, ?, ?, ?, ?, ?, ?, ?, 'Contact', ?)
17:33:09,300 DEBUG [AbstractBatcher] Executing batch size: 1
17:33:09,310 DEBUG [AbstractBatcher] about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
17:33:09,310 DEBUG [ConnectionManager] skipping aggressive-release due to flush cycle
17:33:09,310 DEBUG [UpdateTimestampsCache] Pre-invalidating space [Account]
17:33:09,310 DEBUG [AbstractBatcher] about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
17:33:09,310 DEBUG [SQL]
    /* update
        fr.ccip.gefi.domain.Account */ update
            Account
        set
            name=?,
            primary_contact_fk=?,
            company_contact_fk=?
        where
            id=?
Hibernate:
    /* update
        fr.ccip.gefi.domain.Account */ update
            Account
        set
            name=?,
            primary_contact_fk=?,
            company_contact_fk=?
        where
            id=?
17:33:09,310 DEBUG [AbstractBatcher] Executing batch size: 1
17:33:09,350 DEBUG [AbstractBatcher] about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
17:33:09,350 DEBUG [ConnectionManager] skipping aggressive-release due to flush cycle
17:33:09,350 DEBUG [ConnectionManager] aggressively releasing JDBC connection
17:33:09,350 DEBUG [ConnectionManager] releasing JDBC connection [ (open PreparedStatements: 0, globally: 0) (open ResultSets: 0, globally: 0)]
17:33:09,360 DEBUG [UpdateTimestampsCache] Invalidating space [Contact], timestamp: 4810376762818560
17:33:09,360 DEBUG [UpdateTimestampsCache] Invalidating space [Account], timestamp: 4810376762818561
17:33:09,360 DEBUG [JDBCContext] TransactionFactory reported no active transaction; Synchronization not registered
17:33:09,360 DEBUG [ManagedEntityManagerFactory] ************** closing entity managersession **************



Je ne comprends pas pourquoi il semble avoir 2 prepared statement d'ouverts et qu hibernate ne realise pas un batch jdbc (1 seul prepared statement et une execution de la totalite dans un meme prepared statement.
Pour l insertion, je devine que, vu que mes pk sont generees par la sequence hibernate, hibernate a besoin de recuperer la pk generee pour l inserer dans l autre entite, mais pour l update, je ne vois ou ca cloche.

Pourriez vous me dire si je me trompe et/ou comment realiser reellement un batch en update / insert.

Merci d avance de votre aide
alexandre

_________________
JBOSS AS 4.0.5 EJB 3
Oracle AS 10.1.3 Hibernate 3.2.0

JDK 5


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

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.