如何将json对象作为参数发送给调用过程的本机查询?

时间:2016-09-19 13:59:48

标签: java json oracle procedure nativequery

大家好我的dout是我有一个jsonobject并且我将这个对象作为参数发送到nativeQuery:

Query query = entityManager
            .createNativeQuery("{call myprocedure(?)} ");
    query.setParameter(1, myjson);

我得到了错误:

10:54:06,362 WARN  [JDBCExceptionReporter] SQL Error: 907, SQLState: 42000
10:54:06,362 ERROR [JDBCExceptionReporter] ORA-00907 missing right parenthesis

我的json对象:

{"phone":4834378165,"observation":"","colaborator_open":"S","reason":"asdf","location_description":"","residence_number":"","colaborator_registration":901546,"amount":0,"street_id":"0","colaborator_type":"T","name":"client","solicitation_type":"I","is_printed":"N","subsidiary_type":5,"service_code":5930,"amount_informed":0,"staff_visit":"N"}

1 个答案:

答案 0 :(得分:0)

解决了更改函数的过程并调用如下:

 select  myFunction(?) from dual