I am trying to use slick in the play framework but struggling with even the simplest of examples.
Here is my code:
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)
}
When I compile this I get the following error:
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
]
Can anyone tell me if I have something wrong here?
Thanks
Further Details:
I have found the issue. I have a companion object that was conflicting
If you have a companion object you need to use a slightly different syntax for your * projection:
def * = (id, email, password, permission) <> ((Account.apply _).tupled, Account.unapply)