2017-02-15 130 views
2

在這個頁面中的Java部分:https://neo4j.com/blog/cypher-load-json-from-url/爲什麼在java中的這個示例代碼不工作?

db.execute(query, singletonMap("json",json)); 

給出了一個錯誤,那就是The method execute(String, Map<String,Map>) is undefined for the type GraphDatabaseService

在類GraphDatabaseService中沒有名爲「execute」的方法,我無法找到有關此類的文檔。有誰知道發生了什麼?

neo4j是否改變了它的庫,並沒有相應地調整代碼,或者我錯過了一些需要下載的庫(我已經下載了neo4j-kernel-1.8.1.jar和neo4j-java-driver-1.1.0.sources .jar並將它們添加到路徑中)?

回答

1

使用Neo4j 2.2.0或更高版本。

execute方法已被添加到版本爲2.2.0的GraphDatabaseService

比較:Neo4J 2.2.0Neo4J 2.1.8

還要注意的是GraphDatabaseService在較新的版本搬到neo4j-graphdb-api-x.y.z.jar,而你會發現它在neo4j-kernel-x.y.z.jar爲更低的版本。

相關問題