def insertBatch():Unit={ DB.withConnection { implicit connection => val batch = BatchSql( SQL("INSERT INTO books(title, author) VALUES({title}, {author})"), Seq( Seq[(String, ParameterValue[String])]("title" ->toParameterValue("Play 2 for Scala"), "author" -> toParameterValue("Peter Hilton")), Seq[(String, ParameterValue[String])]("title" -> toParameterValue("Learning Play! Framework 2"), "author" -> toParameterValue("Andy Petrella")) )) println(batch) val res: Array[Int] = batch.execute() } }
playframework2.2.x anorm 批量插入
最新推荐文章于 2018-11-20 17:25:38 发布