With Slick, I am trying to project database table entries directly to the case class they represent. Following the example in the documentation, I set up a mapped projection using the <>
operator:
case class SomeEntity3(id: Int, entity1: Int, entity2: Int)
val SomeEntityTable = new Table[SomeEntity3]("some_entity_table") {
def id = column[Int]("id", O.PrimaryKey, O.AutoInc)
def entity1 = column[Int]("entity1")
def entity2 = column[Int]("entity2")
def * = id ~ entity1 ~ entity2 <> (SomeEntity3, SomeEntity3.unapply _)
}
Now, I'd like to add some static constants and auxiliary methods to SomeEntity3. For that, I create a companion object. But as soon as I include the line
object SomeEntity3
a pretty wild multi-line error pops up for the definition of *
saying something illegible about "overloaded method value <> with alternatives".
How does the companion object relate to bi-directional mapping in Slick and can I somehow accomplish my goal?