wood burning stoves 2.0*
The moose likes Object Relational Mapping and the fly likes Enabling batch updates in hibernate Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Enabling batch updates in hibernate" Watch "Enabling batch updates in hibernate" New topic
Author

Enabling batch updates in hibernate

Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8919

Is batch update enabled by default in Hibernate ? If not how do I enable them.


Groovy
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

No. There is no way to explicitly enable batch updates. Hibernate (or any ORM technology for that matter) is not a good fit for batch processing.
[ March 01, 2006: Message edited by: Paul Sturrock ]

JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Emanuel Kadziela
Ranch Hand

Joined: Mar 24, 2005
Posts: 186
Check out the hibernate.jdbc.batch_size property you can set in hibernate properties (it is explained a little bit in the documentation on the hibernate.org site). Maybe it will give you some help.
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8919

Thanks Paul and Emanuel. The Hibernate document says that a batch update property needs to be set.

Paul,
What are better ways of doing a batch update ? A stored procedure ?
How do I pass records from a Java program to a stored procedure ? I am talking about the data structure to be used. I am using oracle database , so will VARRAY be a good choice?

Thanks

Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8919

Originally posted by Paul Sturrock:
No. There is no way to explicitly enable batch updates. Hibernate (or any ORM technology for that matter) is not a good fit for batch processing.

[ March 01, 2006: Message edited by: Paul Sturrock ]


Why is ORM not fit for doing batch updates ? Is it because java objects are created for each record?Thanks.
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

Yeah basically. Of course it depends on the size of the batch. Smallish batches are fine (Hibernate does that all the time). But with big sets of data you may see performance issues.
Stephane Clinckart
Ranch Hand

Joined: Oct 21, 2003
Posts: 89
Hi,

What do you think about ODAL ORM for batch update ???

http://odal.sourceforge.net/pdf/odal-guide.pdf

I never tried it but seems to be a good compromise between ORM and batch.

I should like to get an opinion.

Thanks a lot.

Stephane
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Enabling batch updates in hibernate