Win a copy of Spring Boot in Practice this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

Enabling batch updates in hibernate

 
Ranch Hand
Posts: 8944
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is batch update enabled by default in Hibernate ? If not how do I enable them.
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Ranch Hand
Posts: 187
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 8944
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 8944
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
reply
    Bookmark Topic Watch Topic
  • New Topic