在neo4j中编写存储过程,然后将其添加到neo4j插件中。调用存储过程时出现错误”
org.neo4j.kernel.api.exceptions.TransactionFailureException: Transaction rolled back even if marked as successful
以下是有关我的表现的一些信息。
@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: Transaction rolled back even if marked as successful
请帮助我尽快解决它。
最佳答案
我已经解决了这个问题。实际上,当我们点击存储过程时,它会隐式打开一个事务,因此如果您尝试在同一线程中打开另一个事务。它会带来问题。
关于java - 在 neo4j 中出现以下错误 "org.neo4j.kernel.api.exceptions.TransactionFailureException: Transaction rolled back even if marked as successful",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38091795/