This week's giveaway is in the Programmer Certification (OCPJP) forum.
We're giving away four copies of Java Mock Exams (software) and have David Mayer on-line!
See this thread for details.
Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Application crashes or closed before batch insert is completed

 
Kunal Lakhani
Ranch Hand
Posts: 622
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am working on a hibernate application
In my Dao class there is a for loop
in this for loop following steps are repeated for all registered members

Step 1 : Get the new member id
Step 2 : Perform some action, save it, transaction.commit, shutdown the session.
Step 3 : Different session, transaction object. Get the object saved in Step 2, perform some actions, save a new different entity, transaction.commit
Step 4 : Go to step 1, get the new member id, and repeat steps

As soon as the members id list is over, come out of Dao

My problem is, what if, in between the process , any exception is raised, or , computer shuts down? The remaining id wont run. Its also necessary to use "transaction.commit" in step 2, as step 3 uses it. Also, these steps corresponds to a single id each time a for loop runs

The point to be noted is, either all the codes of that class should run successfully, or if, everything is roll backed (in case of exception)
Also, what if pc shuts down, or browser is closed, I dont think there is any solution to it. And the application will crash / or incomplete batch inserts will run (i am afraid of that)
 
Kunal Lakhani
Ranch Hand
Posts: 622
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No reply yet

 
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!