• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Enabling batch updates in hibernate

 
Pradeep bhatt
Ranch Hand
Posts: 8927
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is batch update enabled by default in Hibernate ? If not how do I enable them.
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Emanuel Kadziela
Ranch Hand
Posts: 187
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 8927
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 8927
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 89
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic