在 neo4j 上获取以下错误"org.neo4j.kernel.api.exceptions.TransactionFailureException: Transaction rolled back



在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:事务回滚,即使标记为成功

请帮忙,我需要尽快解决这个问题

我已经解决了这个问题实际上,当我们到达存储进程时,它会隐式地打开一个事务,所以如果您尝试在同一线程中打开另一个事务。它带来了问题。

最新更新