简体   繁体   English

Anorm只是锁定executeUpdate

[英]Anorm is just locking on executeUpdate

I have a very simple Play 2.1 Scala project. 我有一个非常简单的Play 2.1 Scala项目。 As in, this is the only code in it so far. 如上所示,这是到目前为止的唯一代码。 I have a task which I am running with an Akka.system.scheduler . 我有一个正在使用Akka.system.scheduler运行的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. 我有一些代码可以从数据库(当前为标准测试H2实例)中选择,并且我几乎完全按照文档示例进行操作

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. 它永远不会超过2.5。 I haven't got any other database operations happening (except for evolutions). 我没有发生任何其他数据库操作(演化除外)。

Help? 救命?

Based on your link, shouldn't your SQL statement look like: 根据您的链接,您的SQL语句不应看起来像:

 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} . 在问题中,值没有大括号: {a, b, c}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM