I tried to debug some functions in REPL:
activator console -Dconfig.file=conf/test.conf
scala> new play.core.StaticApplication(new java.io.File("."))
scala> import models._
The lines above works well, but when I call a method which depends on an implicit DB session, it complains:
scala> Employee.listProjectsByEmployee(5)
<console>:11: error: could not find implicit value for parameter db: play.api.db.slick.Database
Employee.listProjectsByEmployee(5)
I tried to import a DB value like this, but it didn't work:
scala> implicit val myDb = play.api.db.slick.DB
<console>:10: error: You do not have an implicit Application in scope. If you want to bring the current running Application into context, just add import play.api.Play.current
implicit val myDb = play.api.db.slick.DB
I also tried to import Play.current but it didn't work, either..
scala> import play.api.Play.current
import play.api.Play.current
scala> implicit val myDb = play.api.db.slick.DB
<console>:12: error: You do not have an implicit Application in scope. If you want to bring the current running Application into context, just add import play.api.Play.current
implicit val myDb = play.api.db.slick.DB
And this didn't work either..
implicit val myDb2 = play.api.db.slick.Database
myDb2: play.api.db.slick.Database.type = play.api.db.slick.Database$@7e0b6883
Does anyone have ideas about how to import an implicit play.api.db.slick.Database?
Thanks!