-
Aug 26th, 2008, 10:44 PM
#1
how can I do if I need to do some other jobs after step transaction rollback
Hello, I have a question to consult every experts. How can I do if I need to do some other jobs after step transaction rollback?
-
Aug 27th, 2008, 09:23 AM
#2
Perhaps you could provide some more details as to what you're trying to do after a step rollback. Are you trying to log out some information?
-
Aug 27th, 2008, 08:52 PM
#3
may be I need to mark a flag or trigger other programs to finish the clear jobs.
Then how can I do?
-
Aug 28th, 2008, 10:02 AM
#4
I'm sorry, but I'm still unclear as to what you're trying to accomplish. We really need more details.
-
Aug 30th, 2008, 09:24 PM
#5
Following is my program, I set the commitInterval in the configuration file, and the spring batch framework will commit my data to db automatically. And if the framework roll back , I want to trigger another program in the close method to do some clear jobs. But I don't know how to verify if the transaction is rollback.
public class DBProcessItemWriter implements ItemWriter, ItemStream, InitializingBean {
private ProductDao productDao;
public void write(Object item) throws Exception {
Product product=new Product();
product.setProductNumber(item.getProductNum());
product.setLastUpdateTime(new Date());
productDao.persist(product);
}
public void close(ExecutionContext executionContext) throws ItemStreamException {
if(transaction commit normally){
clear the temp data;
}else{
trigger another program;
}
}
}
-
Aug 31st, 2008, 03:27 AM
#6
You could use a StepExecutionListener (just implement that interface as well). The on error callback gives you the failure case, and the success case is just to move on to the next step.
-
Sep 4th, 2008, 12:28 AM
#7
Sorry, can you give me a sample for this approach?
-
Sep 4th, 2008, 02:32 AM
#8
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules