使用json对象进行Anorm(Scala)查询(Postgres)

时间:2017-10-10 13:16:36

标签: postgresql scala anorm

我正在尝试使用Anorm(Postgres)编写此sql查询: SELECT * FROM employee WHERE id = 1 AND length(ee_json #>> '{path1,paht2}') BETWEEN 0 and 1;

它应该是这样的:

 SQL(
 s"""
  |SELECT id FROM employee  WHERE id = {id}
  |AND length(ee_json #>> {param} ) BETWEEN  {min} and {max}
  """.stripMargin)
  .on('id -> id,
  'min -> min,
  'max -> max,
  'param -> "'{path1,path2}'")
  .as(parser.*)

但是当我运行它时我得到ArrayIndexOutOfBoundsException

0 个答案:

没有答案