插入数据时无法解析符号

Cannot resolve symbol when inserting data

我正在学习本教程,http://slick.typesafe.com/doc/3.1.0/gettingstarted.html#populating-the-database。当我复制该代码时,它说 'cannot resolve symbol...' my code

我正在使用 IntelliJ

app/controllers/tables.scala:

import slick.driver.H2Driver.api._
import slick.lifted.{ProvenShape, ForeignKeyQuery}


class Suppliers(tag: Tag)
extends Table[(Int, String, String, String, String, String)](tag, "SUPPLIERS") {

def id: Rep[Int] = column[Int]("SUP_ID", O.PrimaryKey)
def name: Rep[String] = column[String]("SUP_NAME")
def street: Rep[String] = column[String]("STREET")
def city: Rep[String] = column[String]("CITY")
def state: Rep[String] = column[String]("STATE")
def zip: Rep[String] = column[String]("ZIP")

def * : ProvenShape[(Int, String, String, String, String, String)] =
  (id, name, street, city, state, zip)
}

class Coffees(tag: Tag)
extends Table[(String, Int, Double, Int, Int)](tag, "COFFEES") {

def name: Rep[String] = column[String]("COF_NAME", O.PrimaryKey)
def supID: Rep[Int] = column[Int]("SUP_ID")
def price: Rep[Double] = column[Double]("PRICE")
def sales: Rep[Int] = column[Int]("SALES")
def total: Rep[Int] = column[Int]("TOTAL")

def * : ProvenShape[(String, Int, Double, Int, Int)] =
  (name, supID, price, sales, total)

def supplier: ForeignKeyQuery[Suppliers, (Int, String, String, String, String, String)] =
  foreignKey("SUP_FK", supID, TableQuery[Suppliers])(_.id)
}

application.conf:

h2mem1 = {
url = "jdbc:h2:mem:test"
driver = org.h2.Driver
connectionPool = disabled
keepAliveConnection = true
}
// im using jdbc:h2:~/test as my URL in H2 Console(port 8082)
// currently using Generic H2 (Embedded)
db.default.driver=org.h2.Driver
db.default.url="jdbc:h2:mem:test;MODE=MYSQL;DB_CLOSE_DELAY=-1"
db.default.username=sa
db.default.password=""

构建:

libraryDependencies ++= Seq(
 jdbc,
 cache,
 ws,
 specs2 % Test,
 "com.typesafe.slick" %% "slick" % "3.1.0",
 "com.h2database" % "h2" % "1.4.190",
 "org.slf4j" % "slf4j-nop" % "1.6.4",
 "com.typesafe.slick" %% "slick-codegen" % "3.1.0"
)
libraryDependencies += evolutions

我正在使用 IntelliJ IDE,获得了我需要的所有插件:play、scala 等。我还缺少其他东西吗?还是我的代码

它无法解析 supplierscoffees,至少,因为您错过了它们的定义:

val suppliers = TableQuery[Suppliers]

val coffees = TableQuery[Coffees]