I use java rest binding of Neo4j on my project, but I face a problem on 
handling transactions.https://github.com/neo4j/java-rest-binding

When the name is Error, it can success insert node into DB..., event if I 
take off Transactioncontrol, it still works.

I also post it 
on 
http://stackoverflow.com/questions/23648082/fail-to-handle-transaction-on-java-rest-binding-of-neo4j

final RestAPI api = new RestAPIFacade("http://localhost:7474/db/data";);
final RestCypherQueryEngine engine = new RestCypherQueryEngine(api);

Transaction tx = api.beginTx();
try {
    String name = "Error";
    Map<String, Object> subMap = new HashMap<String, Object>();
    subMap.put("name", name);
    subMap.put("age", 17);
    Node node = api.createNode(subMap);
    Label label = DynamicLabel.label("Student");
    node.addLabel(label);

    if("Error".equals(name)) {
        tx.failure();
    }
    else {
        tx.success();
    }
} finally {
    tx.finish();
}

-- 
You received this message because you are subscribed to the Google Groups 
"Neo4j" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to