创建历史表 - Ebean ORM Java PlayFramework

Create History Tables - Ebean ORM Java PlayFramework

您好,我正在尝试按照 ebean orm 说明创建和使用历史表,我的模型代码如下所示

package models;

import com.avaje.ebean.Model;
import play.data.validation.Constraints;

import javax.persistence.Entity;
import javax.persistence.Id;
import java.util.Date;


@History
@Entity
public class LegalStuff extends Model {
    @Id
    public Long id;

    @Constraints.Required
    public String body;
}

编译时出现以下错误。

    play.sbt.PlayExceptions$CompilationException: Compilation error[cannot find symbol
  symbol: class History]
    at play.sbt.PlayExceptions$CompilationException$.apply(PlayExceptions.scala:27) ~[na:na]
    at play.sbt.PlayExceptions$CompilationException$.apply(PlayExceptions.scala:27) ~[na:na]
    at scala.Option.map(Option.scala:145) ~[scala-library-2.11.7.jar:na]
    at play.sbt.run.PlayReload$$anonfun$taskFailureHandler.apply(PlayReload.scala:49) ~[na:na]
    at play.sbt.run.PlayReload$$anonfun$taskFailureHandler.apply(PlayReload.scala:44) ~[na:na]
    at scala.Option.map(Option.scala:145) ~[scala-library-2.11.7.jar:na]
    at play.sbt.run.PlayReload$.taskFailureHandler(PlayReload.scala:44) ~[na:na]
    at play.sbt.run.PlayReload$.compileFailure(PlayReload.scala:40) ~[na:na]
    at play.sbt.run.PlayReload$$anonfun$compile.apply(PlayReload.scala:17) ~[na:na]
    at play.sbt.run.PlayReload$$anonfun$compile.apply(PlayReload.scala:17) ~[na:na]

我需要跟踪以上表格中数据的历史记录。请指教

为了解决编译错误,您应该为 @History annotation:

提供正确的导入

import com.avaje.ebean.annotation.History;

将 Playframework 升级到版本 2。5.x Ebean 在 Sbt-play-ebean 中设置为 3.0.0...

这是因为 sbt-play-ebean 1.0.0 不支持@History