Question

I have a very simple Play 2.1 Scala project. As in, this is the only code in it so far. I have a task which I am running with an Akka.system.scheduler. I have some code to select from the database (currently the standard test H2 instance) and I'm following the documentation example almost exactly.

DB.withConnection { implicit c =>
  Logger.info("2")
  var x = SQL("insert into x (a, b, c) values ({a, b, c})").on(
    'a -> a,
    'b -> b,
    'c -> c
  )
  Logger.info("2.5")
  x.executeUpdate()
  Logger.info("3")

It never gets past 2.5. I haven't got any other database operations happening (except for evolutions).

Help?

Was it helpful?

Solution

Based on your link, shouldn't your SQL statement look like:

 var x = SQL("insert into x (a, b, c) values ({a}, {b}, {c})").on(
    "a" -> a,
    "b" -> b,
    "c" -> c
  )

In the question the values don't have individual braces: {a, b, c}.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top