This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Object Relational Mapping and the fly likes hibernate property  order_insert / order_update Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "hibernate property  order_insert / order_update" Watch "hibernate property  order_insert / order_update" New topic

hibernate property order_insert / order_update

shai ban
Ranch Hand

Joined: Jan 05, 2010
Posts: 177
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.

shai ban
Ranch Hand

Joined: Jan 05, 2010
Posts: 177
does that means nobody knows about it or I am not able to make you understand

I agree. Here's the link:
subject: hibernate property order_insert / order_update
Similar Threads
Hibernate does not save Object / Record
Error in executeUpdate
Dynamic SQL Generation
Column appears twice - Hibernate generated prepared statement
Hibernate query not mapped