-->
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: Batch insert & delete using the "set" mapping to a String
PostPosted: Thu Jan 09, 2014 7:24 am 
Newbie

Joined: Thu Jan 09, 2014 7:09 am
Posts: 1
Hi,

I'm using Hibernate 3.6 and I'm experiencing a weir behaviour while manipulating collections. In my case, I'm using the "set" element in hbm.xml like this:

<class name="Person" table="PERSON">
<id column="DBID_" name="dbid">
<generator class="native" />
</id>
<property name="name" column="NAME" type="string" />
<set name="adresses" cascade="all" table="ADDRESS" fetch="join">
<key foreign-key="FK_PERSON_ID">
<column name="PERSON_ID" index="IDX_ADDRESS"/>
</key>
<element type="string" column="ADDRESS"/>
</set>
</class>

My code is creating a new Person and add 100 addresses inside. I have monitored the statements generated (using MySQL logs) and I got 100 insert statements into table ADDRESS. I tried the various batch size properties in hibernate configuration but it does not help.
hibernate.jdbc.batch_size 100
hibernate.jdbc.batch_versioned_data true
hibernate.default_batch_fetch_size 100
hibernate.jdbc.fetch_size 100

I also read in the documentation that I can set batch-size attribute in my mapping but this would only affect the fetching of addresses from a person correct?

Do you know how I can reduce the number of insert statements to insert my 100 rows?

Thanks,
Charles


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.