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 6733761
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T10:48:29+00:00 2026-05-26T10:48:29+00:00

I am revamping a dataloader that reads from flat file and batchinsert using jdbctemplate

  • 0

I am revamping a dataloader that reads from flat file and batchinsert using jdbctemplate for every 500 items. I am using java executor fixed thread pool that submits tasks, which does reading each file and batchupdate. For example when reading first file, if it fails during 3rd batchinsert ,all the previous batchinsert for this file needs to be rollbacked. The task should continue with next file and create a new transaction for insert. I needed a code that can do this . Currently I am using transactiontemplate and wrapping the batchinsert code inside doInTransactionwithoutcallbackand during exception in catch block calling transaction status.setrollbackonly. But I need a code which can create new transaction for next file irrespective of whether last file failed or succeded.setting propagation to requires new solves it?

  • 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-05-26T10:48:30+00:00Added an answer on May 26, 2026 at 10:48 am

    As Sean commented, you should not reinvent the whole thing, and use Spring Batch instead.

    Spring Batch will allow you to:

    • partition the execution (e.g. using a thread pool executor)
    • map records in the file(s) to objects
    • set the right commit interval, where it’d commit a “chunk” of processed records, and rollback in case any of them are “wrong”
    • specify what errors are skippable, retryable
    • and much more

    And it is already there => coded, tested and awesome.

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

Sidebar

Related Questions

Is there a way to detect file renaming using Java? (NIO's WatchService API or
I'm currently revamping the way our shop does version-control. We will be using a
Is there any Workaround/Tool for renaming the Resource Keys from the resource file .
I am revamping a website that (now) uses Prototype framework. In the process of
I am revamping a website that now uses jQuery. The process is more than
Just a quick question: I'm working on revamping a script that serves vehicle inventory
I'm renaming a file using boost::filesystem, and sometimes the target file will exist. According
I created a test project using a web.config file by renaming it to same
I'm revamping a site using http://www.designinfluences.com/fluid960gs/ Fluid 960 uses uses MooTools as well as
In my Java application I am renaming files to a file name provided in

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.