【发布时间】:2017-10-03 17:19:16
【问题描述】:
我是游戏框架的新手。我有一个项目,但它给我带来了问题。
我使用 Play Framework 2.5.9 和 ebean 3.0.2。错误如下:
play.sbt.PlayExceptions$CompilationException: Compilation error[value where is not a member of com.avaje.ebean.Finder[Long,models.Viaje]]
at play.sbt.PlayExceptions$CompilationException$.apply(PlayExceptions.scala:27)
at play.sbt.PlayExceptions$CompilationException$.apply(PlayExceptions.scala:27)
at scala.Option.map(Option.scala:145)
at play.sbt.run.PlayReload$$anonfun$taskFailureHandler$1.apply(PlayReload.scala:49)
at play.sbt.run.PlayReload$$anonfun$taskFailureHandler$1.apply(PlayReload.scala:44)
at scala.Option.map(Option.scala:145)
at play.sbt.run.PlayReload$.taskFailureHandler(PlayReload.scala:44)
at play.sbt.run.PlayReload$.compileFailure(PlayReload.scala:40)
at play.sbt.run.PlayReload$$anonfun$compile$1.apply(PlayReload.scala:17)
at play.sbt.run.PlayReload$$anonfun$compile$1.apply(PlayReload.scala:17)
生成的错误也与模型类有关。在每个类中,我都定义了以下方法:
public static Finder<Long, Motorista> find = new Finder<Long,Motorista>(Motorista.class);
我按照以下命名法进行任何查询:
Motorista.find.findList ();
或:
Motorista.find.where (). eq ( "id", 1);
问题是,在我进行这些查询的所有行中,上述错误总是后面跟着错误,错误说:
value findList is not a member of com.avaje.ebean.Finder [Long, models.Motorista]
和
value where is not a member of com.avaje.ebean.Finder [Long, models.Motorista]
我认为这可能是一个配置问题,尽管该项目对我来说运行良好。
我的 build.sbt 文件包含以下内容
名称 := """siiaf"""
版本 := "1.0-SNAPSHOT"
lazy val myProject = (project in file(".")).enablePlugins(PlayJava, PlayEbean)
scalaVersion := "2.11.7"
libraryDependencies ++= Seq(
javaJdbc,
cache,
javaWs
)
libraryDependencies += "mysql" % "mysql-connector-java" % "5.1.36"
我的 plugins.sbt 文件包含以下内容:
// The Play plugin
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.5.9")
// Web plugins
addSbtPlugin("com.typesafe.sbt" % "sbt-coffeescript" % "1.0.0")
addSbtPlugin("com.typesafe.sbt" % "sbt-less" % "1.1.0")
addSbtPlugin("com.typesafe.sbt" % "sbt-jshint" % "1.0.4")
addSbtPlugin("com.typesafe.sbt" % "sbt-rjs" % "1.0.8")
addSbtPlugin("com.typesafe.sbt" % "sbt-digest" % "1.1.1")
addSbtPlugin("com.typesafe.sbt" % "sbt-mocha" % "1.1.0")
addSbtPlugin("org.irundaia.sbt" % "sbt-sassify" % "1.4.6")
// Play enhancer - this automatically generates getters/setters for public fields
// and rewrites accessors of these fields to use the getters/setters. Remove this
// plugin if you prefer not to have this feature, or disable on a per project
// basis using disablePlugins(PlayEnhancer) in your build.sbt
addSbtPlugin("com.typesafe.sbt" % "sbt-play-enhancer" % "1.1.0")
// Play Ebean support, to enable, uncomment this line, and enable in your build.sbt using
// enablePlugins(PlayEbean).
addSbtPlugin("com.typesafe.sbt" % "sbt-play-ebean" % "3.0.2")
请帮忙
【问题讨论】:
标签: java scala playframework