Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

hibernate property order_insert / order_update

 
shai ban
Ranch Hand
Posts: 177
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI All,
Lets consider a relationship Book -> Chapter
For every Book insertion, hibernation will insert two insert One for Book and another for Chapter. Hibernate 'batch_size' option will fail here because it only BATCHes statements when same type of statement are going to be insert. Here there are alternating statement for Book and Chapter so Hibernate will insert by every insert.
So for maximize performance, we can set property 'order_insert=true' , it will sort the same type of statements and BATCH will come in picture then and performance will improved.

Now the problem is, if it is unidirection association and Chapter stores FK to Book and after sorting the insert statement, if all CHAPTERs get inserted first then will any error come there because till that time you don't have BOOK id.

Hope, I am able to make you understand my query.

Thanks.
 
shai ban
Ranch Hand
Posts: 177
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
does that means nobody knows about it or I am not able to make you understand

Thanks.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic