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.
posted 5 years ago
does that means nobody knows about it or I am not able to make you understand