Reputation: 309
I created java(spring) app on heroku, connected postgresql to it. When I make request on app, log shows
WARN 4 --- [io-14883-exec-3] o.h.engine.jdbc.spi.SqlExceptionHelper : SQL Error: 0, SQLState: 42P01 app[web.1]: 2016-12-11 12:13:09.942 ERROR 4 --- [io-14883-exec-3] o.h.engine.jdbc.spi.SqlExceptionHelper : ERROR: relation "dish" does not exist app[web.1]: Position: 13 app[web.1]: 2016-12-11 12:13:10.031 ERROR 4 --- [io-14883-exec-3] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.dao.InvalidDataAccessResourceUsageException: could not execute statement; SQL [n/a]; nested exception is org.hibernate.exception.SQLGrammarException: could not execute statement] with root cause app[web.1]: org.postgresql.util.PSQLException: ERROR: relation "dish" does not exist app[web.1]: Position: 13
application.properties:
spring.datasource.url=${JDBC_DATABASE_URL}
spring.datasource.driver-class-name=org.postgresql.Driver
spring.datasource.maxActive=10
spring.datasource.maxIdle=5
spring.datasource.minIdle=2
spring.datasource.initialSize=5
spring.datasource.removeAbandoned=true
spring.jpa.database-platform=org.hibernate.dialect.PostgreSQLDialect
spring.jpa.generate-ddl=false
#spring.jpa.hibernate.ddl-auto=create
spring.jpa.show-sql=true
This model works on my local machine
Model:
@Entity
public class Dish
implements Serializable
{
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
private Long dishId;
private Long categoryId;
private String name;
private String description;
private Float price;
private String picUrl;
public Long getId()
{
return this.dishId;
}
public void setId(Long dishId)
{
this.dishId = dishId;
}
public Long getCategoryId()
{
return this.categoryId;
}
public void setCategoryId(Long categoryId)
{
this.categoryId = categoryId;
}
public String getName()
{
return this.name;
}
public void setName(String name)
{
this.name = name;
}
public String getDescription()
{
return this.description;
}
public void setDescription(String description)
{
this.description = description;
}
public Float getPrice()
{
return this.price;
}
public void setPrice(Float price)
{
this.price = price;
}
public String getPicUrl()
{
return this.picUrl;
}
public void setPicUrl(String picUrl)
{
this.picUrl = picUrl;
}
}
Upvotes: 2
Views: 5025
Reputation: 324445
#spring.jpa.hibernate.ddl-auto=create
is commented out. So Hibernate won't create your tables. Which is why they don't exist.
Upvotes: 2