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!

本文标签: