I connect with jdbc:postgresql://localhost:5432/mydatabase?currentSchema=myschema
.
I have the following configuration for SimpleJdbcInsert. I use Spring Boot.
@Bean
@Qualifier("simpleJdbcInsert")
public SimpleJdbcInsert simpleJdbcInsert(@Qualifier("dataSource") DataSource dataSource) {
return new SimpleJdbcInsert(dataSource).withTableName("tableX").usingGeneratedKeyColumns("id");
}
But i get the following execption:
org.springframework.dao.DataAccessResourceFailureException: Unable to locate table meta data for 'tableX' in the default schema
I don't know why, because i thought that i set the currentSchema=myschema
already.
I don't want to do following because i set the currentSchema=myschema
in the JDBC URL above.
new SimpleJdbcInsert(dataSource).withSchemaName("Schema1").withTableName("tableX").usingGeneratedKeyColumns("id");