Wonko
Wonko

Reputation: 176

Slick: JdbcProfile has no JdbcType

I get the Exception

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

with the following code:

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)

I'm using Slick 3.0 with Postgres 9,4.

How can I rectify? Thanks!

Upvotes: 0

Views: 285

Answers (1)

Tom
Tom

Reputation: 340

This is actually covered in the Slick 3.0 docs.

From those 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.

Hope this helps!

Upvotes: 1

Related Questions