-->
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.  [ 2 posts ] 
Author Message
 Post subject: Batch inserts
PostPosted: Thu Feb 10, 2005 12:57 pm 
Beginner
Beginner

Joined: Thu Jul 22, 2004 8:09 am
Posts: 20
Read the rules before posting!
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:
2.1.7

Mapping documents:

Code between sessionFactory.openSession() and session.close():

Full stack trace of any exception that occurs:

Name and version of the database you are using:
Oracle

The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:

If I want to do batch writes to the database all I have to do is set the property in the config file...

<property name="hibernate.jdbc.batch_size">25</property>

I have a few questions about how the batch stuff works.

Does Hibernate store the items you are going to insert/update in the session until it reaches it's batch limit, then write everything?

If the limit is never reached, I assume it does the batch when commit() is called, is that correct?

If I am using the "identity" id generation method and I insert a row with batch enabled, do I have the ability to get the PK from the recently inserted object, even if the batch has not gone off?

Finally, is there a limit to the batch_size or a number that you would suggest not going above?

Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 10, 2005 5:53 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Hibernate executes DML at "flush-time", the meaning of which is clearly defined in the documentation....


....except for inserts with an identity column. In which case batching is dsiabled.

The sensible batch-size depends upon your JDBC driver and environment.


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