admin管理员组文章数量:1300022
I'm working on a Spring Batch project using Spring Boot 2.7.2 and PostgreSQL as the database.
When I try to run my application using:
# mvn spring-boot:run
I get the following error:
**.postgresql.util.PSQLException: ERROR: relation "batch_job_instance" does not exist Position: 39*
*
However, the batch_job_instance table already exists in my database.
I have verified this by running:
# SELECT * FROM batch_job_instance
;
This query works without errors and returns data.
What I’ve tried: Checked that my application is connecting to the correct database by running:
# SELECT current_database();
It returns the expected database name.
Verified that batch_job_instance exists in pg_tables:
# SELECT * FROM pg_tables WHERE tablename = 'batch_job_instance';
It returns a result, confirming the table exists.
Ensured that spring.batch.initialize-schema=never is set, since the tables are already created.
Tried using the schema name explicitly in queries:
# SELECT * FROM public.batch_job_instance;
This also works.
application.properties:
# spring.datasource.url=jdbc:postgresql://localhost:5432/mydb
spring.datasource.username=myuser
# spring.datasource.password=mypassword
# spring.datasource.driver-class-name=.postgresql.Driver
# spring.jpa.database-platform=.hibernate.dialect.PostgreSQL10Dialect
# spring.batch.initialize-schema=never
`# spring.jpa.hibernate.ddl-auto=none```
Why is Spring Batch unable to find the batch_job_instance table despite it existing?
Could this be a schema issue? How do I explicitly tell Spring Batch to look in the correct schema?
Are there any additional configurations needed for PostgreSQL to work correctly with Spring Batch?
Would appreciate any help in resolving this! Thanks!
本文标签:
版权声明:本文标题:java - Spring Batch with PostgreSQL: ERROR: relation "batch_job_instance" does not exist (Table already exists 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741655848a2390755.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论