-->
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.  [ 3 posts ] 
Author Message
 Post subject: Hibernate Help
PostPosted: Sat Aug 04, 2007 12:56 am 
Newbie

Joined: Sat Jul 28, 2007 2:06 am
Posts: 3
Hi
I want to know the difference between Hibernate JDBC fetch Size property and JDBC batch Size property.
When to use each one and when not use?
Also

I set the batch size once while the program ran and then removed it.
It now retains the old value that I set
Please help

Sreeks


Top
 Profile  
 
 Post subject:
PostPosted: Sat Aug 04, 2007 5:07 am 
Expert
Expert

Joined: Fri Jul 13, 2007 8:18 am
Posts: 370
Location: london
fetch_size is a JDBC configuration property applied to com.sql.Statement. From the Statement java doc:
Quote:
void setFetchSize(int rows) throws SQLException
Gives the JDBC driver a hint as to the number of rows that should be fetched from the database when more rows are needed for ResultSet objects genrated by this Statement. If the value specified is zero, then the hint is ignored. The default value is zero.

Parameters:
rows - the number of rows to fetch


Batch size is a hibernate configuration property not a JDBC property. It can be applied to entities or collections. When configured, hibernate will fetch multiple uninitialised proxies in a single statement. This can be used to improve performance.

e.g.
I have a Company object that contains a set of Employees. Employee contains a Person object and a Role object. Lets say I load a company and navigate to its employees. Hibernate creates a proxy for each of the Person objects in the loaded employees. If I have 10 employees and iterate over them to print their names, 10 select statements will be issued to initialise the 10 Person proxies that were created. If I set a batch-size="10" on Person, hibernate will initialise all 10 proxies in one go with a single select statement.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 06, 2007 11:48 pm 
Newbie

Joined: Sat Jul 28, 2007 2:06 am
Posts: 3
Thank you very much


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