0

In the upgrade guide of Slick 3.0, I found contents like this:

In Slick 1.0 it was common practice to place extra static methods associated with a table into that table’s object. You can do the same in 2.0 with a custom TableQuery object:

object suppliers extends TableQuery(new Suppliers(_)) {
  // put extra methods here, e.g.:
  val findByID = this.findBy(_.id)
}

Does this mean putting static methods into the table's object is not a common practice or not recommended in Slick 2.x/3.x? (By the way, the syntax of object suppliers extends TableQuery(new Suppliers(_)) looks a bit weird.)

If it is not, what is the preferred way to put the static methods?

Hanfei Sun
  • 45,281
  • 39
  • 129
  • 237

1 Answers1

0

You can't create objects from Slick >= 2.0's table classes anymore. The tag it tags can only be generated by Slick. Extend TableQuery instead, so object suppliers extends TableQuery(new Suppliers(_)) is the place.

cvogt
  • 11,260
  • 30
  • 46