-->
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.  [ 5 posts ] 
Author Message
 Post subject: How can I disable batch update and insert
PostPosted: Fri Mar 02, 2012 6:26 am 
Newbie

Joined: Thu Mar 01, 2012 11:41 am
Posts: 3
Hi
I observe too much time spent on commit. I checked the code, a great amount of time is spent on checkStyle for batch updates, and I guess it is because of unnecessary batch updates. I know that I will commit after one insert, so batch update is no help to me.
I tried to disable batch update. setting batch_size zero, does not help. It uses batch update functions, but do it one by one.
I checked the code, it seems that this line of code is responsible to decide whether to use batch or not:
final boolean useBatch = j == 0 && expectation.canBeBatched();

Could you please let me know how can I configure hibernate not to use batch update ?

-- Saeid


Top
 Profile  
 
 Post subject: Re: How can I disable batch update and insert
PostPosted: Fri Mar 02, 2012 6:32 am 
Expert
Expert

Joined: Tue Jun 16, 2009 3:36 am
Posts: 990
jdbc-batching should be in fact disabled if you set hibernate.jdbc.batch_size to 0
Which version of hibernate are you using?
Can you show your part of configuration where you put batch_size to zero ?
Maybe you do some wrong with the syntax...


Top
 Profile  
 
 Post subject: Re: How can I disable batch update and insert
PostPosted: Fri Mar 02, 2012 10:03 am 
Newbie

Joined: Thu Mar 01, 2012 11:41 am
Posts: 3
This is how I do it:

<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="hibernate.transaction.manager_lookup_class">blah blah blah</property>
<property name="hibernate.dialect">net.atos.xa.dialect.XAOracle10gDialect</property>
<property name="hibernate.hbm2ddl.auto">validate</property>
<property name="hibernate.show_sql">false</property>
<property name="hibernate.format_sql">false</property>
<property name="hibernate.cache.provider_class">net.sf.ehcache.hibernate.EhCacheProvider</property>
<property name="hibernate.cache.use_second_level_cache">true</property>
<property name="hibernate.cache.use_query_cache">true</property>
<property name="hibernate.jdbc.batch_size">0</property>

</session-factory>
</hibernate-configuration>


Is there any problem with it ?


Top
 Profile  
 
 Post subject: Re: How can I disable batch update and insert
PostPosted: Fri Mar 02, 2012 11:19 am 
Expert
Expert

Joined: Tue Jun 16, 2009 3:36 am
Posts: 990
Seems properly configured.

Which Hibernate Dialect and which version of hiberante are you using?

Please enable info-logging level, so if batchSize is greater than zero, following loggin should appear while initializing hibernates SessionFactory

Code:
if (batchSize>0) log.info("JDBC batch size: " + batchSize);


Top
 Profile  
 
 Post subject: Re: How can I disable batch update and insert
PostPosted: Fri Mar 09, 2012 8:47 am 
Newbie

Joined: Thu Mar 01, 2012 11:41 am
Posts: 3
Hi
Thank you for the guide. my problem was that I did not checked all the configuration files.
Of course my performance problem remains there !


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 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.