Slick3.2错误:找不到匹配的形状

时间:2018-01-04 07:46:03

标签: scala slick-3.0

我不确定这里有什么问题。

以下代码块抛出错误:

   (for {
      (e,r) <- tblDetail.joinLeft(tblMaster).on((e,r) => r.col1 === e.col3)
    } yield (e.id)

错误

No matching Shape found.
[error] Slick does not know how to map the given types.
[error] Possible causes: T in Table[T] does not match your * projection,
[error]  you use an unsupported type in a Query (e.g. scala List),
[error]  or you forgot to import a driver api into scope.
[error]   Required level: slick.lifted.FlatShapeLevel
[error]      Source type: (slick.lifted.Rep[Int], slick.lifted.Rep[String],...)
[error]    Unpacked type: T
[error]      Packed type: G
[error]           (e,r) <- tblDetail.joinLeft(tblMaster).on((e,r) => r.col1 === e.col3)

我查看了光滑表格tblDetailtblMaster它们似乎没问题。

tblMaster

class TblMaster(tag:Tag)
    extends Table[(Int,String,...)](tag, "tbl_master") {
  def id                  = column[Int]("id")
  def col3  = column[String]("col3")

  def * = (id,col3)
}

tblDetail

class TblDetail(tag:Tag)
    extends Table[Entity](tag, "tbl_detail") {
  def id                  = column[Int]("id")
  def col1  = column[String]("col1")

  def * : ProvenShape[Entity] = (id,col1) <>
           ((Entity.apply _).tupled, Entity.unapply)
}

任何帮助都会很明显。

0 个答案:

没有答案