2

play フレームワークで slick を使用しようとしていますが、最も単純な例でも苦労しています。

これが私のコードです:

case class Account (
  id: Int,
  email: String,
  password: String,
  permission: String
)

class Accounts(tag: Tag) extends Table[Account](tag, "account") {
  def id = column[Int]("id")
  def email = column[String]("email")
  def password = column[String]("password")
  def permission = column[String]("permission")

  def * = (id, email, password, permission)
}

これをコンパイルすると、次のエラーが発生します。

play.PlayExceptions$CompilationException: Compilation error[No matching Shape found.
Slick does not know how to map the given types.
Possible causes: T in Table[T] does not match your * projection. Or you use an unsupported type in a Query (e.g. scala List).
  Required level: scala.slick.lifted.ShapeLevel.Flat
     Source type: (scala.slick.lifted.Column[Int], scala.slick.lifted.Column[String], scala.slick.lifted.Column[String], scala.slick.lifted.Column[String])
   Unpacked type: models.Account
     Packed type: Any
]

ここで何か問題があるかどうか誰かに教えてもらえますか?

ありがとう

詳細:

  • スカラ 2.10
  • スリック 2.0.2
  • プレイスリック 0.6.0.1
  • Play フレームワーク 2.3.1
4

2 に答える 2

3

http://slick.typesafe.com/doc/2.0.2/schemas.htmlによると、「*」投影法は次のようになるはずです。

def * = (id, email, password, permission) <> (Account.tupled, Account.unapply)
于 2014-06-26T21:08:07.013 に答える