【发布时间】:2015-08-20 16:28:39
【问题描述】:
在 play-java-intro 模板上,它会抛出 PersistenceException: org.hibernate.exception.SQLGrammarException: could not prepare statement,因为找不到 PERSON 表。
例外:
- org.hibernate.engine.jdbc.spi.SqlExceptionHelper - Table "PERSON" not found; SQL statement:
这是来自 play-intro-java 模板(Play Framework 2.4)的默认 Person 模型类:
package models;
import javax.persistence.*;
@Entity
public class Person {
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
public int id;
public String name;
}
Play 应首先运行 Database Evolution,因此将首先创建 PERSON 表。在 build.sbt per instruction 中添加了 libraryDependencies += evolutions 行,但没有运气。在 Play 2.3.9 中没有遇到过这个问题。
Play 2.4 使用 JPA 进行模型/持久性,其中 Play 2.3 和以前的版本使用 Ebean ORM。
【问题讨论】:
-
您是自动应用进化还是通过选择应用脚本手动进行?
标签: hibernate playframework playframework-2.4