Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Hibernate Hibernate4 hibernate.jdbc.batch_size

Related Tutorials


 
 

Share on Google+Share on Google+

hibernate.jdbc.batch_size

Advertisement
In this section, you will learn about the hibernate.jdbc.batch_size of the hibernate.cfg.xml.

hibernate.jdbc.batch_size

In this section, you will learn about the hibernate.jdbc.batch_size of the hibernate.cfg.xml.

The sample hibernate.cfg.xml file is given below :

<?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>
<!-- Database connection settings -->
<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="connection.url">jdbc:mysql://192.168.10.13:3306/anky</property>
<property name="connection.username">root</property>
<property name="connection.password">root</property>

<property name="dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="hibernate.jdbc.batch_size">50</property>

<!-- List of mapping classes -->
<mapping class="net.roseindia.Address" />
<mapping class="net.roseindia.Employee" />

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

The hibernate.jdbc.batch_size is used to define the batch size. In the above hibernate.cfg.xml, the batch size is set to 50.

In the batch update, multiple update queries are sending  in a single batch to the database table. The hibernate.jdbc.batch_size property tag define the batch size. In the above hibernate.cfg.xml, we set the batch size to 50.

You can relate the batch update as sending 50 files in zipped folder than sending 50 files individually.

If the batch size is higher then you need more memory . If the batch size is low, you need more round trips to the database.

Advertisement

If you enjoyed this post then why not add us on Google+? Add us to your Circles



Liked it!  Share this Tutorial


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: April 18, 2012

Related Tutorials

Discuss: hibernate.jdbc.batch_size  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments:0
DMCA.com