spring-projects / spring-projects/spring-batch

Clarify SQL Server < 2012 support and document table-based incrementer workaround

Open Beginner friendly
#5,035 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

status: waiting-for-triage type: feature
Dominant language
Java
Stars
3k
Forks
2.5k
Avg merge
6d 53m
Merged PRs (30d)
3

Description

Expected Behavior

The reference documentation should clearly explain that SQL Server 2012 or later is required
because Spring Batch 5 uses database sequences (SELECT NEXT VALUE FOR ...) in the default schema.

It should also provide a short "Legacy SQL Server" note describing how to use
a table-based incrementer (SqlServerMaxValueIncrementer) as a workaround for
older SQL Server versions (such as 2005) that do not support sequences.

For example:

Note: SQL Server 2012+ is required for the default schema.
For older versions without sequence support, create dedicated sequence tables
(e.g., BATCH_JOB_SEQ) and configure SqlServerMaxValueIncrementer to use them.


Current Behavior

When using Spring Batch 5.x with SQL Server 2005 or any version without sequence support,
the framework fails to initialize the job repository with the following error:

org.springframework.dao.DataAccessResourceFailureException: Could not obtain sequence value

This happens because the current implementation (SqlServerSequenceMaxValueIncrementer)
executes the SELECT NEXT VALUE FOR ... query, which is not supported prior to SQL Server 2012.
There is no fallback or documentation describing this limitation.


Context

I encountered this issue while using Spring Batch with SQL Server 2005.
Older SQL Server versions are still found in legacy enterprise systems, and developers
might face this issue without understanding why it occurs.

By documenting the limitation and providing a workaround,
users can manually configure Spring Batch to work with legacy SQL Server versions
(using table-based incrementers) instead of being blocked by the sequence requirement.

I have already implemented this workaround successfully in my environment,
and I would be happy to contribute a documentation PR with examples
(DDL + configuration snippet) to help others avoid the same problem.


Contributor Note

I'm willing to work on this improvement myself and submit a pull request
to add the proposed clarification and example to the reference documentation.

Thanks for considering this!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in the Spring Batch reference documentation for SQL Server database initialization and read the existing schema and incrementer guidance. Document that SQL Server 2012+ is required for the default sequence-based schema, then add a concise legacy note covering dedicated sequence tables and SqlServerMaxValueIncrementer configuration. Done means the version limitation and workaround are clear to users of older SQL Server releases.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
databases, documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
62/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.