2

Slick Codegen は、マップされたすべてのケース クラスを の外部で生成して、${container} trait その型を継承しないようにすることはできますか? たぶん、まったく別のファイルにありますModels.scalaか?

// SuppliersRowsDAA.scala
import persistence.Tables

object SuppliersRowsDAA {
  case class Save(sup: Tables.SuppliersRow)
}   

次のコンパイル エラーが発生します。

[error] /app/src/main/scala/persistence/dal/SuppliersDAA.scala:5: type mismatch;
[error]  found   : persistence.Tables.SuppliersRow
[error]  required: SuppliersDAA.this.SuppliersRow
[error]     case Save(sup) ⇒ sender ! db.run(Suppliers += sup)

Tables#SuppliersRowimport を使用すると、同じエラーが発生します。

SuppliersRow自動生成されたケースクラスの外側で手動でカットアンドペーストするtrait Tablesと動作します!

....

trait Tables {

....
}
case class SuppliersRow(id: Int, userId: Int, name: String)
//EOF
4

1 に答える 1