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
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.
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
The text was updated successfully, but these errors were encountered:
Hi @tirtawn, in Spring Boot 3 the annotation @EnableBatchProcessing disables the auto-configuration for Spring Batch, which has not been the case in Spring Boot 2. Please try removing the annotation.
Thanks for the document.
"@EnableBatchProcessing is now discouraged
Previously, @EnableBatchProcessing could be used to enable Spring Boot’s auto-configuration of Spring Batch. It is no longer required and should be removed from applications that want to use Boot’s auto-configuration. A bean that is annotated with @EnableBatchProcessing or that extends Batch’s DefaultBatchConfiguration can now be defined to tell the auto-configuration to back off, allowing the application to take complete control of how Batch is configured."
Got it, I have gotten used to this annotation. Now I know this is no longer necessary.
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
The text was updated successfully, but these errors were encountered: