title: How to define generic type in Scala?
body: <p>In Slick 2, we can map tables like this:</p>
  
  <pre><code>case class Cooler(id: Option[Int], minTemp: Option[Double], maxTemp: Option[Double])
  
  /**
   * Define table "cooler".
   */
  class Coolers(tag: Tag) extends Table[Cooler](tag, "cooler") {
    def id = column[Int]("id", O.PrimaryKey, O.AutoInc)
    def minTemp = column[Double]("min_temp", O.Nullable)
    def maxTemp = column[Double]("max_temp", O.Nullable)
  
    def * = (id.?, minTemp.?, maxTemp.?) &lt;&gt; (Cooler.tupled, Cooler.unapply _)
  }
  
  object Coolers {
    val tableQuery = TableQuery[Coolers]
  }
  </code></pre>
  
  <p>because I have a lot of tables, I want to define generic methods for them, like <code>find</code>, <code>delete</code>, <code>update</code> so I have to define these methods in a super class from where to extend my objects (<code>object Coolers extends TableUtils[Coolers, Cooler]</code>). In order to define those methods, I need <code>tableQuery</code> to move out of my object in this super class, so I tried it like:</p>
  
  <pre><code>abstract class TableUtils[T &lt;: Table[A] , A] {
  
  val tableQuery = TableQuery[T]  
  
  }
  </code></pre>
  
  <p>but I receive an error on <code>tableQuery</code> definition:</p>
  
  <p><code>class type required but T found</code></p>
  
  <p>Does anybody know what I am doing wrong?</p>