Slick:JdbcProfile 没有 JdbcType

Slick: JdbcProfile has no JdbcType

我得到异常

slick.SlickException: JdbcProfile has no JdbcType for type Vector[{cardId: Int', consensusId: Int'}]

使用以下代码:

case class CardConsensus(cardId: Int, consensusId: Int)
case class CardConsensuses(tag: Tag) extends Table[CardConsensus](tag, Some("MagicCardDump"), "CardConsensus") {
  def cardId = column[Int]("cardId")
  def consensusId = column[Int]("consensusId")
  def * = (cardId, consensusId) <> (CardConsensus.tupled, CardConsensus.unapply)
}

val CardConsensusTable = TableQuery[CardConsensuses]

val cardConsensusQuery = CardConsensusTable.groupBy(c ⇒ c.consensusId)
val alternatives = Await.result(Db.run(cardConsensusQuery.result), 30 minutes)

我在 Postgres 9,4 中使用 Slick 3.0。

我该如何纠正?谢谢!

这实际上包含在 Slick 3.0 docs.

来自那些文档:

SQL requires to aggregate grouped values. We require the same in Slick for now. This means a groupBy call must be followed by a map call or will fail with an Exception. This makes Slick’s grouping syntax a bit more complicated than SQL’s.

希望对您有所帮助!