java-rest-binding
java-rest-binding copied to clipboard
Cannot create Relationship from/to non-batched Nodes in BatchCallback
While this works:
TestBatchResult r = this.restAPI.executeBatch(new BatchCallback<TestBatchResult>() {
@Override
public TestBatchResult recordBatch(RestAPI batchRestApi) {
TestBatchResult result=new TestBatchResult();
result.n1 = batchRestApi.createNode(map("name", "newnode1"));
result.n2 = batchRestApi.createNode(map("name", "newnode2"));
result.rel = batchRestApi.createRelationship(result.n1, result.n2, Type.TEST, map("name", "rel") );
result.allRelationships = result.n1.getRelationships();
return result;
}
});
This won't:
final Node node1 = graphDb.getNodeById(1);
final Node node2 = graphDb.getNodeById(2);
TestBatchResult r = this.restAPI.executeBatch(new BatchCallback<TestBatchResult>() {
@Override
public TestBatchResult recordBatch(RestAPI batchRestApi) {
TestBatchResult result=new TestBatchResult();
result.rel = batchRestApi.createRelationship(node1, node2, Type.TEST, map("name", "rel") );
return result;
}
});
Thanks for reporting it.
I'll add a test for it.