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

  • Home
  • SEARCH
  • 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 1013691
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T10:08:34+00:00 2026-05-16T10:08:34+00:00

I am experienced with Spring, but new to Spring Batch. Now I have the

  • 0

I am experienced with Spring, but new to Spring Batch. Now I have the task to migrate a data structure from a simple structure in one database to a complexer one in the other. The data structure corresponds to an object hierarchy that I will name like this

OldParent 1 --> n OldChild // old system

NewParent 1 --> n NewChild // new system

In the old db, there are only two tables, in the new system, things get a lot more complex and there are 8 tables, but that is irrelevant for now.

Basically I would like to use a simple JDBC-based solution with rowmappers reading from OldParent and converting to NewParent.

So here would be a basic configuration snippet:

<batch:job id="migration">
    <batch:step id="convertLegacyData">
        <batch:tasklet>
            <batch:chunk
                reader="parentReader"
                writer="parentWriter"
                commit-interval="200" />
        </batch:tasklet>
    </batch:step>
</batch:job>

In this scenario, the parentReader would acquire and convert the OldChild objects, probably delegating to a childReader / childWriter objects.

The problem is this: while there are several hundred thousand Parents, each Parent can have zero to several million children, so the commit-interval based on parent would not help at all, but I would very much like to have a configurable commit interval.

So another solution would be to make the workflow child-based:

<batch:job id="migration">
    <batch:step id="convertLegacyData">
        <batch:tasklet>
            <batch:chunk
                reader="childReader"
                writer="childWriter"
                commit-interval="200" />
        </batch:tasklet>
    </batch:step>
</batch:job>

In this scenario, the childReader would have to also read OldParent objects and write NewParents, delegating to parentReader and parentWriter objects. The major drawback here is that I am losing all OldParents that don’t have associated OldChild objects.

The third possible scenario would be to have two different workflows for OldParent -> NewParent and OldChild -> NewChild. (I would have to maintain a mapping table that stores the relationship between OldParent and NewParent ids, but I could use standard configurations including commit-interval.

Are there other possibilities? Which of these would you recommend as best practice?

  • 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-16T10:08:34+00:00Added an answer on May 16, 2026 at 10:08 am

    Doesn’t it have a N-records commit-interval configuration? Doesn’t it uses something like BatchUpdates (JDBC) so you can configure N-sized batch updates and a commit for each batchupdate.

    If it doesn’t I have a hack 🙂

    Make your own java.sql.Connection implementation. One that passes all the commands to the original connection and plus, executes a commit after each N-th update… 🙂

    If you’re using a DatabasePool you can wrap the original too, to return a wrapped connection with the hack.

    I know it’s a little weird proposition… but maybe it’s all you need for a one-time migration.

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

Sidebar

Related Questions

I'm an experienced coder, but am still relatively new to the STL, and have
Most of experienced programmer knows data alignment is important for program's performance. I have
Totally new to Spring & Java development but working on a project for a
I'm an experienced programmer, but relatively new to SQL. We're using Oracle 10 and
I'm an experienced client application developer (C++/C#), but need to come up to speed
Our team is experienced in web development (tomcat/Oracle) but not with AJAX on our
I've experienced rather strange behavior of JSTL forEach tag. I have some bean called
I'm a pretty experienced Grails developer, but most of my experience has been with
I'm still quite new to Spring, and I've found it to irritating making all
Definitely a LINQ newbie, but very experienced with SQL and C# and wondering if

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.