try (Transaction tx = graphDb.beginTx()) { Node node = graphDb.createNode(); node.setProperty("name", "John Doe"); } catch (Exception e) { tx.failure(); } MATCH (a:Person {name: 'John Doe'}) CREATE (b:Person {name: 'Jane Smith'})-[r:FRIENDS]->(b) RETURN a, b, r try (Transaction tx = graphDb.beginTx()) { Node node = graphDb.getNodeById(1); } catch (Exception e) { tx.failure(); } try (Transaction tx = graphDb.beginTx()) { ResourceIterator<Node> nodes = graphDb.findNodes(Label.label("Person")); while (nodes.hasNext()) { Node node = nodes.next(); } } catch (Exception e) { tx.failure(); }


上一篇:
下一篇:
切换中文