以下是java创建的neo4j链接,同时查询 if(graphDb==null){ graphDb = new GraphDatabaseFactory() .newEmbeddedDatabaseBuilder(new File(“neo4j/neo4jDatabase”)) .setConfig( bolt.type, “BOLT” ) .setConfig( bolt.enabled, “true” ) .setConfig( bolt.address, “localhost:7687” ) .setConfig(GraphDatabaseSettings.allow_upgrade,“true”) .newGraphDatabase(); } try(Transaction tx = graphDb.beginTx()) { org.neo4j.graphdb.Result result = graphDb.execute(“match ® where r.metaType=‘DIRECTORY’ or r.metaType=‘SECONDLEVEL’ return r”); 以下是javascript创建neo4j链接,同时查询: ajaxByNeo4j: function() { var driver = neo4j.v1.driver(“bolt://localhost:7687/neo4jDatabase/data”); var session = driver.session(); var tx = session.beginTransaction(); var success = false; tx .run(“match ® where r.metaType=‘DIRECTORY’ or r.metaType=‘SECONDLEVEL’ return r”) .then(function (result) { result.records.forEach(function (record) { vm.nodeses.push(record._fields[0].properties); }); console.log(vm.nodeses); vm.getHomeData(); success = true; // session.close(); }) .catch(function (error) { console.log(error); }); if (success) { tx.commit(); } else { //transaction is rolled black and nothing is created in the database console.log(‘rolled back’); tx.rollback(); } // driver.close(); }, 两者查处的数据不同,但是用的是一个库啊,这是什么原因,求大神解释,在这里跪谢!!!
java中创建的内嵌neo4j数据库,在javascript访问中数据不同步