I have a scenario where-in i need to persist an entity and its dependent objects into database. I have run into a position where-in i have to insert about 50000 such objects one after the other from a web application. Now doing this in a loop would take about 3 hours to process.
I want to change the approach to pass the hibernate entities to a stored procedure and execute them on the database side since this would take considerably lesser time in execution.
I want to know if this can be done and if yes, how can this be accomplished. The following example can be taken as reference.
Parent A, Parent B - Both may or may not have dependency. Parent C - Independent parent. Parent B has 3 children - Child A, Child B, Child C. Child B has also reference to parent C.
|