java-rest-binding icon indicating copy to clipboard operation
java-rest-binding copied to clipboard

Cannot create Relationship from/to non-batched Nodes in BatchCallback

Open ceefour opened this issue 13 years ago • 1 comments

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;
        }
    });

ceefour avatar Jul 04 '12 16:07 ceefour

Thanks for reporting it.

I'll add a test for it.

jexp avatar Jul 04 '12 16:07 jexp