Вопрос

I was trying to get a simple Play 2.2/Slick 2.0.0-M3/Postgres 9.2 test app going, being new to Slick and only so experienced with Play. I noticed Slick's been making great progress with simplifying the API, so I prefer 2.0. However, I don't see any examples in the Play-Slick 0.5.0.8 documentation that use 2.0, and when I took a shot at it anyway, it seemed rather incompatible...

When I tried an insert:

def create = DBAction { implicit rs =>
  val users = TableQuery[Users]
  users.insert((9, "uname", "temppass", "test@whatever.com", 10, 11, "139132"))
  Ok("success")
}

I get this compile time error:

could not find implicit value for parameter session: scala.slick.jdbc.JdbcBackend#SessionDef

If I don't use the play-slick, I get no errors with:

def create = Action { request =>
  Database.forDataSource(DB.getDataSource()) withSession { implicit session =>
    val users = TableQuery[Users]
    users.insert((9, "uname", "temppass", "test@whatever.com", 10, 11, "139132"))
  }
  Ok("success")
}

Am I mistaken somehow about play-slick not supporting Slick 2.0 yet? And if not, are there any big reasons to stick with the play-slick plugin with Slick 1?

Это было полезно?

Решение

It has not been ported to Slick 2 yet. The reason to stick with Slick 1 is that Slick 2 has not been released :). There is an experimental milestone release out, but the stable release will take until the end of the year.

Другие советы

It doesn't seem to be officially announced, and Typesafe Activator sample is still at 1.x branch, but some closed issue means to suggest it works, and there's even a sample: https://github.com/freekh/play-slick/pull/117

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top