我已经开始使用我的neo4j基础了...... 我的neo4j要求更新的版本,而我的是最新版本,我是否需要更正我的代码中的任何内容(此处如下)或安装或更新的任何内容。
**在代码中newEmbeddedDatabase已被弃用,我不知道如何纠正..
**当我启动neo4j服务器时,它显示一条Alert消息 "无法使用较旧的数据存储版本启动Neo4j。要启用自动升级,请设置配置参数" allow_store_upgrade = true" "
**我启用了allow_store_upgrade = true并使用了neo4j 2.3.2 请帮我 提前致谢
package neo4j;
public class neo4j_demo {
public static void main(String[] args)
{
GraphDatabaseFactory dbFactory =new GraphDatabaseFactory();
GraphDatabaseService db= dbFactory.newEmbeddedDatabase("C:/TPNeo4jDB");
try (Transaction tx = db.beginTx()) {
Node javaNode = db.createNode(Tutorials.JAVA);
javaNode.setProperty("TutorialID", "JAVA001");
javaNode.setProperty("Title", "Learn Java");
javaNode.setProperty("NoOfChapters", "25");
javaNode.setProperty("Status", "Completed");
Node scalaNode = db.createNode(Tutorials.SCALA);
scalaNode.setProperty("TutorialID", "SCALA001");
scalaNode.setProperty("Title", "Learn Scala");
scalaNode.setProperty("NoOfChapters", "20");
scalaNode.setProperty("Status", "Completed");
Relationship relationship = javaNode.createRelationshipTo
(scalaNode,TutorialRelationships.JVM_LANGIAGES);
relationship.setProperty("Id","1234");
relationship.setProperty("OOPS","YES");
relationship.setProperty("FP","YES");
tx.success();
}
System.out.println("Done successfully");
}
}
答案 0 :(得分:0)
你检查过你的maven依赖吗?您可能希望用此替换您的maven条目。
<dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j</artifactId>
<version>2.X.X</version>
</dependency>