Skip to content

Instantly share code, notes, and snippets.

@danielpcox
Created May 2, 2012 12:20
Show Gist options
  • Save danielpcox/2576193 to your computer and use it in GitHub Desktop.
Save danielpcox/2576193 to your computer and use it in GitHub Desktop.
Neo4j java-rest-binding bug
public class SandboxApp
{
private static Node node1;
private static RelationshipType relType = DynamicRelationshipType.withName("BEHOLD");
public static void main( String[] args ) throws ParseException, JSONException
{
RestAPI restAPI = new RestAPI("http://localhost:7474/db/data");
node1 = restAPI.createNode(map());
restAPI.executeBatch(new BatchCallback<Void>() {
@Override
public Void recordBatch(RestAPI batchRestApi) {
Node node2 = batchRestApi.createNode(map());
// Throws RuntimeException from RestAPI.java, line 135:
node1.createRelationshipTo(node2, relType);
// WORKAROUND - the following succeeds:
// (new RestNode(((RestNode)node1).getUri(), batchRestApi)).createRelationshipTo(node2, relType);
return null;
}
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment