I have written this code which works perfectly
class Items(tag: Tag) extends Table[Item](tag, \"ITEMS\") {
def id = column[Long](\"ITEMS_ID\", O.PrimaryKey
Here's the relevant documentation page, according to which, you should construct a query like this:
val insertQuery = items returning items.map(_.id) into ((item, id) => item.copy(id = id))
def create(name: String, price: Double) : Future[Item] = {
val action = insertQuery += Item(0, name, price)
db.run(action)
}
Try this one instead:
def create(name: String, price: Double): Future[Int] = db.run {
(items returning items.map(_.id)) += Item(0, name, price)
}