title: Scala Slick autoincrementing field
body: <p>This is a similar question to other autoincrement questions, but instead of providing a list of columns to define autoInc, I need to provide a table reference somehow. I am using MySQL</p>
  
  <pre><code>import scala.slick.driver.MySQLDriver.simple._
  import play.Logger
  import slick.session.Database.threadLocalSession
  
  object PaypalCartItems extends Table[PaypalCartItem]("paypalCartItem") {
    def id          = column[Int]("id", O.PrimaryKey, O.AutoInc)
    def itemName    = column[String]("item_name")
    def sku         = column[String]("item_number")
    def quantity    = column[String]("quantity")
    def txnId       = column[String]("txn_id")
    def url         = column[String]("url")
  
    def * = itemName ~ sku ~ quantity ~ txnId ~ url ~ id &lt;&gt; (PaypalCartItem, PaypalCartItem.unapply _)
  
    // I don't want to list out the columns, I need to reference the table
    def autoInc = itemName ~ sku ~ quantity ~ txnId ~ url returning id
  
    def insertItems(items: List[PaypalCartItem]): List[PaypalCartItem] = items map { item: PaypalCartItem =&gt;
      val newId = PaypalCartItems.autoInc.insert(item)
      item.copy(id=newId)
    }
  }
  </code></pre>
  
  <p>The above code does not compile, giving the following:</p>
  
  <pre><code>[error]   overloaded method value insert with alternatives:
  [error]   [TT](query: scala.slick.lifted.Query[TT,(String, String, String, String, String)])(implicit session: scala.slick.session.Session)Seq[Int] &lt;and&gt;
  [error]   (value: (String, String, String, String, String))(implicit session: scala.slick.session.Session)Int
  [error]  cannot be applied to (PaypalCartItem)
  [error]     val newId = PaypalCartItems.autoInc.insert(item)
  </code></pre>