【问题标题】:Getting following error "org.neo4j.kernel.api.exceptions.TransactionFailureException: Transaction rolled back even if marked as successful" at neo4j在 neo4j 出现以下错误“org.neo4j.kernel.api.exceptions.TransactionFailureException:即使标记为成功,事务也会回滚”
【发布时间】:2016-06-29 06:23:05
【问题描述】:

在 neo4j 中编写存储过程,然后将其添加到 neo4j 插件中。调用存储过程时出现错误”

org.neo4j.kernel.api.exceptions.TransactionFailureException: 即使标记为成功,事务也会回滚

以下是一些关于我的表现的信息。

@Procedure("example.search12")
public Stream<SearchHit> searchData(
    @Name("phoneNumber") String phoneNumber, 
    @Name("searchText") String searchText) throws InterruptedException, ExecutionException {

    List<SearchHit> resultList = new ArrayList<>();
    try {
        Node startNode = getStartNode(phoneNumber);
        if(null == startNode){
            System.out.println("Phone Number not found::"+ phoneNumber);
            return null;
        }
        final Set<Node> results = new LinkedHashSet<>();
        innerSeacrh(db, startNode, searchText, 1,results);
        List<Node> nodes = new ArrayList<Node>();

        for (Node node : results) {
            System.out.println(node.getProperty("fullname"));
            nodes.add(node);
            resultList.add(new SearchHit(node));
        }
    } catch(Exception ex) {
        ex.printStackTrace();
    }

    return resultList.stream();
}

public static class SearchHit {
    // This records contain a single field named 'nodeId'
    public long nodeId;

    public SearchHit(Node node) {
        this.nodeId = node.getId();
    }
}

我通过以下命令调用存储过程:

call example.search12("919818131043","anu");

出现以下错误。

org.neo4j.kernel.api.exceptions.TransactionFailureException: 即使标记为成功,事务也会回滚

请帮助我尽快解决。

【问题讨论】:

    标签: java neo4j graph-databases


    【解决方案1】:

    我已经解决了这个问题。实际上,当我们点击存储过程时,它会隐式打开一个事务,因此如果您尝试在同一个线程中打开另一个事务。它带来了问题。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-03-08
      • 2014-10-31
      • 2012-07-13
      • 1970-01-01
      • 2018-05-28
      • 1970-01-01
      • 2010-11-30
      • 2017-12-06
      相关资源
      最近更新 更多