You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Spring Batch with Embedded database on Spring 3.0.5 throws error bad SQL grammar [SELECT JOB_INSTANCE_ID, JOB_NAME from BATCH_JOB_INSTANCE where JOB_NAME = ? and JOB_KEY = ?] #4336
Bug Description:
Create a new project with 3.0.5 with embedded H2 database and create a simple tasklet.
Run the jar file and Spring batch will throw out the error:
PreparedStatementCallback; bad SQL grammar [SELECT JOB_INSTANCE_ID, JOB_NAME from BATCH_JOB_INSTANCE where JOB_NAME = ? and JOB_KEY = ?]
The same project (while using jobBuilderFactory and stepBuilderFactory) on 2.7.7 will work fine.
Note: If you create the schema using org/springframework/batch/core/schema-h2.sql then the jar file will work.
Environment
Spring 3.0.5
Java 17
Maven
Steps to reproduce
Steps to reproduce the issue.
Attach the simple springdemo.zip - a very simple empty tasklet job to reproduce the issue.
Note: Creating the H2 database using file database and run the h2-schema.sql will fix the issue.
The same bug can be reproduced on different database e.g. PostGres.
Expected behavior
Expected that spring batch will create the tables on the fly when running the job (same behaviour as Spring 2.7.7.
Since I have put on:
application.properties
spring.batch.jdbc.initialize-schema=always
Minimal Complete Reproducible example
springdemo.zip is attached
Compiling and running the jar file should reproduce the error
Please provide a failing test or a minimal complete verifiable example that reproduces the issue.
Bug reports that are reproducible will take priority in resolution over reports that are not reproducible. springdemo.zip