I've created spring-boot application which uses jdbctemplate, everything works great on localhost but when i deploy my application to Heroku and visit the endpoint i'm getting this information :
StatementCallback; bad SQL grammar [SELECT id, name, price, image, description FROM products;]; nested exception is org.postgresql.util.PSQLException: ERROR: relation "products" does not exist Position: 49
If the SQL query is bad then how is that even possible that same application works local machine ?
Here's the method with jdbcTemplate i'm using:
public Products getProductsList() {
ArrayList<Product> productsList = new ArrayList<>();
jdbcTemplate.query(
"SELECT id, name, price, image, description FROM public.products;",
(rs, rowNum) -> new Product(rs.getInt("id"), rs.getString("name"), rs.getFloat("price"), rs.getString("image"), rs.getString("description"))
).forEach(product -> productsList.add(product));
return new Products(productsList);
}