2014-05-14 5 views
0

내 프로젝트에서 Neo4j의 Java REST binding을 사용하지만 트랜잭션 처리시 문제가 있습니다.Neo4j의 java-rest-binding에서 트랜잭션을 처리하지 못했습니다.

이름이 Error 일 때 Transaction 컨트롤을 제거하면 노드를 DB ..., 이벤트에 삽입 할 수 있습니다. 여전히 작동합니다.

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

답변

1

Neo4j 2.x를위한 와이어를 통해 트랜잭션을 지원하는 JDBC 드라이버를 사용하는 것이 좋습니다 것, 그리고 내가 제어 할 수 트랜잭션!

org.neo4j.rest.batch_transaction=true 

그러나 neo4j 받침대 결합의 트랜잭션에 대한 문제가, 당신은 트랜잭션 방법/사이퍼를 얻을 사용할 수 있습니다. 트랜잭션에서 노드 또는 관계를 업데이트/추가/삭제하려는 경우에만 메소드/키퍼를 넣을 수 있습니다.

0

REST를 통한 트랜잭션이 없으며 HTTP 요청 당 하나의 TX입니다. 배치 작업으로 가짜 tx가 있지만 활성화해야합니다.

나는 오히려 내가 true로 파라미터 아래에 설정해야 발견

https://github.com/neo4j-contrib/neo4j-jdbc/tree/2.0

관련 문제