-->
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: Bulk insert of component collection in Hibernate?
PostPosted: Tue Jan 25, 2011 2:49 pm 
Regular
Regular

Joined: Thu Aug 28, 2003 2:42 pm
Posts: 77
Location: The Netherlands
I have the mapping as listed below.

When I update a detached Categories item (that doesn't contain any Hibernate class as it comes from a dto converter) I notice that Hibernate will first delete ALL employer wages instances (the collection link) and then insert ALL employer wage entries ONE-BY-ONE :(...

I understand that it has to delete and then insert all entries as it was completely detached.

BUT, what I don't understand, why is Hibernate NOT inserting all the entries through bulk-insert?..
That is: inserting all the employer wage entries all in one SQL statement ?

I mean: I think a bulk insert performs "much" then X times single inserts...

How can I tell Hibernate to use bulk-insert? (if possible).
I tried playing with the following value but didn't see any difference:

Code:
    hibernate.jdbc.batch_size=30

My mapping snippet:

Code:
   <class name="com.sample.CategoriesDefault" table="dec_cats" >
     <id name="id" column="id" type="string" length="40" access="property">
      <generator class="assigned" />
     </id>
     <component name="incomeInfoMember" class="com.sample.IncomeInfoDefault">
       <property name="hasWage" type="boolean" column="inMemWage"/>
        ...
       <component name="wage" class="com.sample.impl.WageDefault">
         <property name="hasEmployerWage" type="boolean" column="inMemEmpWage"/>
          ...
         <set name="employerWages" cascade="all-delete-orphan" lazy="false">
          <key column="idCats" not-null="true" />
          <one-to-many entity-name="mIWaEmp"/>
         </set>
       </component>
     </component>
    </class>


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.