Skip to content

In a SQL Server environment, when Spring Batch uses a sharding data source, the auto-increment table of the batch framework encounters an execution error. #35268

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
liangleiA opened this issue Apr 27, 2025 · 0 comments

Comments

@liangleiA
Copy link

liangleiA commented Apr 27, 2025

The tables for Spring Batch are managed by the framework itself. In the SQL Server environment, only the business tables are sharded, while the framework's BATCH_* tables are not configured with any sharding rules. However, the sharding parser modifies the default execution statements.

The table creation statement is as follows, with an auto-incrementing primary key:

CREATE TABLE BATCH_JOB_SEQ (ID BIGINT IDENTITY);

The statement is altered by the AbstractSQLBuilder, which adds extra fields to the execution, causing the SQL Server to fail.

Original SQL (executes successfully):

INSERT INTO BATCH_JOB_SEQ DEFAULT VALUES;

Transformed SQL (execution fails):

INSERT INTO BATCH_JOB_SEQ(ID, id) DEFAULT VALUES;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant