This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Object Relational Mapping and the fly likes Application crashes or closed before batch insert is completed Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Reply Bookmark "Application crashes or closed before batch insert is completed" Watch "Application crashes or closed before batch insert is completed" New topic
Author

Application crashes or closed before batch insert is completed

Kunal Lakhani
Ranch Hand

Joined: Jun 05, 2010
Posts: 609
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
Kunal Lakhani
Ranch Hand

Joined: Jun 05, 2010
Posts: 609
No reply yet

 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Application crashes or closed before batch insert is completed
 
Similar Threads
Custom ItemReader & SFDC: Batch result to individual returns
Cloudscape datasource exception
org.hibernate.SessionException: Session is closed
Spring Batch Job seems to be starting one step before last one finishes?
a different object with the same identifier value was already associated with the session