Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8107953
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T00:56:23+00:00 2026-06-06T00:56:23+00:00

I have a Spring Batch process which has following kind of code. <step id=step1

  • 0

I have a Spring Batch process which has following kind of code.

<step id="step1" xmlns="http://www.springframework.org/schema/batch">
        <tasklet allow-start-if-complete="true">
            <chunk reader="reader1" writer="writer1" commit-interval="10"/>
        </tasklet>
    </step>

<bean id="writer1" class="org.springframework.batch.item.file.FlatFileItemWriter">
    <property name="resource" ref="resourceFlatFile" />   
    <property name="shouldDeleteIfExists" value="true" />
    <property name="transactional" value="true" />
    <property name = "lineAggregator"> 
        <bean class="org.springframework.batch.item.file.transform.DelimitedLineAggregator" >
            <property name="delimiter" value=""/>
            <property name ="fieldExtractor"> 
                <bean class="com.path.MyExtractor" />
            </property>  
        </bean>
    </property> 
</bean> 

Basically my reader gives set of records from database. My writer (writer1) writes it to a flat file. If there is any problem in writing a record to the file, I would like to mark that record status as failed in database. So how to handle these kind of scenarios? Any help is appreciated.

Thanks
My question is if I get any kind of exception

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T00:56:24+00:00Added an answer on June 6, 2026 at 12:56 am

    I would recommend you look into using a ItemWriteListener and update the status of the failed records in the onWriteError implementation.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm a newbie in Spring Batch. I have inherited a batch process implemented with
I am new to Spring Batch. I have following question. I am using Spring
I have one spring batch application which can be run from command line. The
I have batch job which reads data from bulk files, process it and insert
Background I have a Spring batch program that reads a file (example file I
I have a spring-batch job that converts various bank statements into my app. There
I have a spring batch program where I am implementing skiplistener class as below:
I am using spring batch to process multiple files using MultiResourcePartitioner and all the
I have a batch file which moves files from one folder to another. The
I have a spring batch program. The skip limit is set to 5 and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.