This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
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)