Spring Batch: Could Not Increment Identity; Nested Exception Is Com.microsoft.sqlserver.jdbc.sqlserverexception: Invalid Object Name 'batch_job_seq'?
We are in the process of moving to Azure SQL Server from Oracle DB for our Spring Batch application. I am getting the following error while trying to execute the job post migration
Solution 1:
Probably the error is related to the migration from Oracle to Azure SQL Server.
As you can see in the source code of the library under the hood Spring Batch uses different strategies when generating the ids for jobs, job executions, and step executions.
In the Oracle case, they use sequences; with SQL Server, they implemented id generation using tables with an identity column.
The migration process also replicated the different Oracle sequences required by Spring Batch and very likely it is causing the issue when the aforementioned SQL Server id generation strategy tries obtaining the next value.
Please, drop the migrated sequences and create the three tables required for SQL Server with the appropriate values:
CREATETABLE BATCH_STEP_EXECUTION_SEQ (
ID BIGINTIDENTITY(<last analogous Oracle sequence value>, 1)
);
CREATETABLE BATCH_JOB_EXECUTION_SEQ (
ID BIGINTIDENTITY(<last analogous Oracle sequence value>, 1)
);
CREATETABLE BATCH_JOB_SEQ (
ID BIGINTIDENTITY(<last analogous Oracle sequence value>, 1)
);
Post a Comment for "Spring Batch: Could Not Increment Identity; Nested Exception Is Com.microsoft.sqlserver.jdbc.sqlserverexception: Invalid Object Name 'batch_job_seq'?"