-
Apr 9th, 2008, 03:46 AM
#1
Retry after recover
Hi all,
I'm using spring-batch 1.0.0.FINAL.
My scenario is as follows:
I read files and inserts their contents into database tables.
I have a case when I may get a foreign key constraint exception that says me that a foreign key reference in the parent table is absent. In the recovering listener I may insert the absent record that caused the exception. But now I want to retry the insert. While debugging I saw that retries happen before recovering. But I need it to be vise versa.
I tried to perform the necessary insert in my implementation of RetryListener.onError(), but got a lock timeout in MySQL table.
I insert file data via iBatis, but add the necessary record in the parent table via Hibernate. For Hibernate save operation I use @Transactional(propagation=Propagation.REQUIRES_NE W) as I want the record to be saved in a new transaction (and be accessible for other jobs that may need this record). But the current transaction causes the lock in database (MySQL InnoDb is used for all the tables).
So I have 2 questions.
1. How may I eliminate the lock?
2. How can I run retries after recovering so that newly created Hibernate transaction will be closed before new retries?
Alex.
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