neo4j-contrib / java-rest-binding

Java Bindings for the Neo4J Server REST API, providing an implementation of GraphDatabaseService
Other
120 stars 72 forks source link

RuntimeException is thrown when calling getOrCreateNode in batch mode #51

Open WeipingGuo opened 11 years ago

WeipingGuo commented 11 years ago

The following code segment works fine if calling from RestAPI directly.

RestNode userNode = restApi.getOrCreateNode(restApi.index().forNodes("user-id"),
                "user-id", userId, null);
        if (userNode != null){
            logger.debug("user node " + userNode.getId() + " is created.");
        }

However if running in a batch mode, I got RuntimeException:

public BatchRestResult recordBatch(RestAPI restApi) {
        BatchRestResult result = new BatchRestResult();
        RestNode userNode = restApi.getOrCreateNode(restApi.index().forNodes("user-id"),
            "user-id", user.getUserId(), null);
java.lang.RuntimeException: Error retrieving or creating node for key user-id and value +972548172847 with index user-id
    at org.neo4j.rest.graphdb.ExecutingRestAPI.getOrCreateNode(ExecutingRestAPI.java:448)
    at org.neo4j.rest.graphdb.RestAPIFacade.getOrCreateNode(RestAPIFacade.java:223)