type TableElementType is abstract inside the class AbstractTable[A] . Scala is unaware of any relationship between A and TableElementType . class Table , on the other hand, defines the final type TableElementType = A , which tells Scala about this relation (and, apparently, Scala is smart enough to use the final annotation to know that the relation is even executed for the T <: Table[A] eventhough Table[A] not a co-option in A ).
Therefore, you need to use T <: Table[A] instead of T <: AbstractTable[A] . And because Table is inside the cake with the Slick box (as in the cake template), you also need to move Crud into your cake. Cakes are viral.
trait Profile { val profile: JdbcProfile } trait CrudComponent{ this: Profile => import profile.simple._ trait Crud[T <: Table[A], A] { val qry: TableQuery[T] def countAll()(implicit session: Session): Int = { qry.length.run } def getAll()(implicit session: Session): List[A] = { qry.list
cvogt source share