简体   繁体   English

org.postgresql.util.PSQLException:错误:关系“ bug_report_model”不存在

[英]org.postgresql.util.PSQLException: ERROR: relation “bug_report_model” does not exist

I'm trying to run a simple java play 2.5 app on heroku. 我正在尝试在heroku上运行一个简单的Java Play 2.5应用程序。 I am able to open the home page which generally means that connection to the database is successful. 我能够打开主页,这通常意味着成功连接到数据库。 But when ever i try to call the route to add a dummy value to the table it shows 但是,当我尝试调用路由向表中添加虚拟值时,它会显示

play.api.UnexpectedException: Unexpected exception[PersistenceException: ERROR executing DML bindLog[] error[ERROR: relation "bug_report_model" does not exist\n   Position: 13]]

The code to add a value to the database is 向数据库添加值的代码是

 public Result enterDummyTextInDb() {
    BugReportModel model = new BugReportModel();
    model.save();
    return ok(Json.toJson(model));
}

The Model class is Model类是

@Entity
public class BugReportModel extends Model {
@Id
private Long id;
private Long timestamp = System.currentTimeMillis();

public BugReportModel() {
}

public static Finder<Long, BugReportModel> find = new Model.Finder<Long, BugReportModel>(BugReportModel.class);

public static List<BugReportModel> findAll() {
    return BugReportModel.find.orderBy("id").findList();
}


public Long getId() {
    return id;
}

public void setId(Long id) {
    this.id = id;
}

public Long getTimestamp() {
    return timestamp;
}

public void setTimestamp(Long timestamp) {
    this.timestamp = timestamp;
}

} }

found something for spring/hibernate that said that the table isnt created and so we have to add 为spring / hibernate找到了一些东西,说该表未创建,因此我们必须添加

spring.jpa.hibernate.ddl-auto=create 

but not sure about it for java play 2.5 但对于Java play 2.5不确定

You need to configure your app to run evolutions by making your Procfile like this: 您需要通过使Procfile像这样配置您的应用程序以运行演进:

web: target/universal/stage/bin/myapp -Dhttp.port=${PORT} -Dplay.evolutions.db.default.autoApply=true -Ddb.default.driver=org.postgresql.Driver -Ddb.default.url=${DATABASE_URL}

For more info see https://www.playframework.com/documentation/2.5.x/ProductionHeroku 有关更多信息,请参见https://www.playframework.com/documentation/2.5.x/ProductionHeroku

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 org.postgresql.util.PSQLException:错误:关系“序列”不存在 - org.postgresql.util.PSQLException: ERROR: relation “sequence” does not exist org.postgresql.util.PSQLException:错误:关系“产品”不存在 - org.postgresql.util.PSQLException: ERROR: relation "products" does not exist org.postgresql.util.PSQLException:错误:关系“用户”不存在 - SpringBoot,Hibernate,Postgresql - org.postgresql.util.PSQLException: ERROR: relation "users" does not exist - SpringBoot, Hibernate, Postgresql 如何解决“Caused by: org.postgresql.util.PSQLException: ERROR: relation “employee” does not exist Position: 13”错误? - How to resolve "Caused by: org.postgresql.util.PSQLException: ERROR: relation "employee" does not exist Position: 13" error? 通过JDBC进行Postgres连接:org.postgresql.util.PSQLException:错误:关系“处方”不存在 - Postgres connectivity via JDBC: org.postgresql.util.PSQLException: ERROR: relation “prescriptions” does not exist org.postgresql.util.PSQLException:错误:关系“员工”不存在 Position:13 - org.postgresql.util.PSQLException: ERROR: relation “employee” does not exist Position: 13 org.postgresql.util.PSQLException:错误:关系“clienti_id_seq”不存在 - org.postgresql.util.PSQLException: ERROR: the relation“clienti_id_seq” does not exist org.postgresql.util.PSQLException:错误:关系不存在PreparedStatement.executeQuery() - org.postgresql.util.PSQLException : ERROR : relation does NOT exist PreparedStatement.executeQuery () org.postgresql.util.PSQLException:错误:关系“app_user”不存在 - org.postgresql.util.PSQLException: ERROR: relation "app_user" does not exist 嵌套异常是 org.postgresql.util.PSQLException:错误:关系“equ_config”不存在 - nested exception is org.postgresql.util.PSQLException: ERROR: relation "equ_config" does not exist
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM