aspose file tools*
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 | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
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: 618
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: 618
No reply yet

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