使用java rest binding的批处理BatchCallBack,报错 Error reading as JSON
发布于 6 年前 作者 butchercode 2135 次浏览 来自 问答

代码如下: RestAPI restAPI = new RestAPIFacade(“http://127.0.0.1:7474/db/data”); restAPI.executeBatch(new BatchCallback<String>() { @Override public String recordBatch(RestAPI batchRestApi) { List<Node> nodes=new ArrayList<Node>(); Map props=new HashMap<String, Object>(); props.put(“id”,600); nodes.add(batchRestApi.createNode(props)); Map props2=new HashMap<String, Object>(); props2.put(“id”,500); nodes.add(batchRestApi.createNode(props2)); //batchRestApi.query(“merge (a{main:{id},prop2:{id}}) merge (b{main:{id}}) create unique (a)-[r:relationshipname]-(b);”, props); return null; } });

如果不加注释的那行可以运行,但加了就会包错Exception in thread “main” java.lang.RuntimeException:Error reading as JSON 当我需要的就是query来执行上万条插入语句

2 回复

你的语句有问题

@wkq278276130 那我运行最简单的batchRestApi.query(“match (n) return n”,Collections.EMPTY_MAP) 也有同样的问题。 而上述语句不用批处理,只直接发送给数据库是没问题的。。 还有呀,如果语句有问题会直接报语法错误的。。

回到顶部