Java Code Examples for org.neo4j.driver.Transaction#commit()

The following examples show how to use org.neo4j.driver.Transaction#commit() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ReactiveNeo4jOperationsIT.java    From sdn-rx with Apache License 2.0 6 votes vote down vote up
@BeforeEach
void setupData() {

	Transaction transaction = driver.session(getSessionConfig()).beginTransaction();
	transaction.run("MATCH (n) detach delete n");

	person1Id = transaction.run("CREATE (n:PersonWithAllConstructor) SET n.name = $name RETURN id(n)",
		Values.parameters("name", TEST_PERSON1_NAME)
	).next().get(0).asLong();
	person2Id = transaction.run("CREATE (n:PersonWithAllConstructor) SET n.name = $name RETURN id(n)",
		Values.parameters("name", TEST_PERSON2_NAME)
	).next().get(0).asLong();

	transaction.commit();
	transaction.close();
}
 
Example 2
Source File: Neo4jOperationsIT.java    From sdn-rx with Apache License 2.0 6 votes vote down vote up
@BeforeEach
void setupData() {

	Transaction transaction = driver.session(getSessionConfig()).beginTransaction();
	transaction.run("MATCH (n) detach delete n");

	person1Id = transaction.run("CREATE (n:PersonWithAllConstructor) SET n.name = $name RETURN id(n)",
		Values.parameters("name", TEST_PERSON1_NAME)
	).next().get(0).asLong();
	person2Id = transaction.run("CREATE (n:PersonWithAllConstructor) SET n.name = $name RETURN id(n)",
		Values.parameters("name", TEST_PERSON2_NAME)
	).next().get(0).asLong();

	transaction.commit();
	transaction.close();
}
 
Example 3
Source File: OptimisticLockingIT.java    From sdn-rx with Apache License 2.0 5 votes vote down vote up
@BeforeEach
void setup() {
	Session session = driver.session(SessionConfig.defaultConfig());
	Transaction transaction = session.beginTransaction();
	transaction.run("MATCH (n) detach delete n");
	transaction.commit();
	session.close();
}
 
Example 4
Source File: ReactiveDynamicLabelsIT.java    From sdn-rx with Apache License 2.0 5 votes vote down vote up
@Override
Long createTestEntity(Transaction transaction) {
	Record r = transaction.run(""
		+ "CREATE (e:SimpleDynamicLabelsCtor:Foo:Bar:Baz:Foobar) "
		+ "RETURN id(e) as existingEntityId").single();
	long newId = r.get("existingEntityId").asLong();
	transaction.commit();
	return newId;
}
 
Example 5
Source File: ReactiveDynamicLabelsIT.java    From sdn-rx with Apache License 2.0 5 votes vote down vote up
@Override
Long createTestEntity(Transaction transaction) {
	Record r = transaction.run(""
		+ "CREATE (e:SimpleDynamicLabelsWithBusinessIdAndVersion:Foo:Bar:Baz:Foobar {id: 'E2', myVersion: 0}) "
		+ "RETURN id(e) as existingEntityId").single();
	long newId = r.get("existingEntityId").asLong();
	transaction.commit();
	return newId;
}
 
Example 6
Source File: ReactiveDynamicLabelsIT.java    From sdn-rx with Apache License 2.0 5 votes vote down vote up
@Override
Long createTestEntity(Transaction transaction) {
	Record r = transaction.run(""
		+ "CREATE (e:SimpleDynamicLabelsWithVersion:Foo:Bar:Baz:Foobar {myVersion: 0}) "
		+ "RETURN id(e) as existingEntityId").single();
	long newId = r.get("existingEntityId").asLong();
	transaction.commit();
	return newId;
}
 
Example 7
Source File: ReactiveDynamicLabelsIT.java    From sdn-rx with Apache License 2.0 5 votes vote down vote up
@Override
Long createTestEntity(Transaction transaction) {
	Record r = transaction.run(""
		+ "CREATE (e:SimpleDynamicLabelsWithBusinessId:Foo:Bar:Baz:Foobar {id: 'E1'}) "
		+ "RETURN id(e) as existingEntityId").single();
	long newId = r.get("existingEntityId").asLong();
	transaction.commit();
	return newId;
}
 
Example 8
Source File: ReactiveDynamicLabelsIT.java    From sdn-rx with Apache License 2.0 5 votes vote down vote up
@Override
Long createTestEntity(Transaction transaction) {
	Record r = transaction.run(""
		+ "CREATE (e:InheritedSimpleDynamicLabels:Foo:Bar:Baz:Foobar) "
		+ "RETURN id(e) as existingEntityId").single();
	long newId = r.get("existingEntityId").asLong();
	transaction.commit();
	return newId;
}
 
Example 9
Source File: ReactiveDynamicLabelsIT.java    From sdn-rx with Apache License 2.0 5 votes vote down vote up
@Override
Long createTestEntity(Transaction transaction) {
	Record r = transaction.run(""
		+ "CREATE (e:SimpleDynamicLabels:Foo:Bar:Baz:Foobar) "
		+ "RETURN id(e) as existingEntityId").single();
	long newId = r.get("existingEntityId").asLong();
	transaction.commit();
	return newId;
}
 
Example 10
Source File: ReactiveOptimisticLockingIT.java    From sdn-rx with Apache License 2.0 5 votes vote down vote up
@BeforeEach
void setup() {

	Session session = driver.session(SessionConfig.defaultConfig());
	Transaction transaction = session.beginTransaction();
	transaction.run("MATCH (n) detach delete n");
	transaction.commit();
	session.close();
}
 
Example 11
Source File: ReactiveProjectionIT.java    From sdn-rx with Apache License 2.0 5 votes vote down vote up
@BeforeEach
void setup() {
	Session session = driver.session();
	Transaction transaction = session.beginTransaction();

	transaction.run("MATCH (n) detach delete n");

	transaction.run("CREATE (:Person{firstName:'" + FIRST_NAME + "', lastName:'" + LAST_NAME + "'})"
		+ "-[:LIVES_AT]->"
		+ "(:Address{city:'" + CITY + "'})");

	transaction.commit();
	transaction.close();
	session.close();
}
 
Example 12
Source File: DynamicLabelsIT.java    From sdn-rx with Apache License 2.0 5 votes vote down vote up
@Override
Long createTestEntity(Transaction transaction) {
	Record r = transaction.run(""
		+ "CREATE (e:DynamicLabelsBaseClass:ExtendedBaseClass1:D1:D2:D3) "
		+ "RETURN id(e) as existingEntityId").single();
	long newId = r.get("existingEntityId").asLong();
	transaction.commit();
	return newId;
}
 
Example 13
Source File: DynamicLabelsIT.java    From sdn-rx with Apache License 2.0 5 votes vote down vote up
@Override
Long createTestEntity(Transaction transaction) {
	Record r = transaction.run(""
		+ "CREATE (e:SimpleDynamicLabels:Foo:Bar:Baz:Foobar) "
		+ "RETURN id(e) as existingEntityId").single();
	long newId = r.get("existingEntityId").asLong();
	transaction.commit();
	return newId;
}
 
Example 14
Source File: DynamicLabelsIT.java    From sdn-rx with Apache License 2.0 5 votes vote down vote up
@Override
Long createTestEntity(Transaction transaction) {
	Record r = transaction.run(""
		+ "CREATE (e:SimpleDynamicLabelsCtor:Foo:Bar:Baz:Foobar) "
		+ "RETURN id(e) as existingEntityId").single();
	long newId = r.get("existingEntityId").asLong();
	transaction.commit();
	return newId;
}
 
Example 15
Source File: DynamicLabelsIT.java    From sdn-rx with Apache License 2.0 5 votes vote down vote up
@Override
Long createTestEntity(Transaction transaction) {
	Record r = transaction.run(""
		+ "CREATE (e:SimpleDynamicLabelsWithBusinessIdAndVersion:Foo:Bar:Baz:Foobar {id: 'E2', myVersion: 0}) "
		+ "RETURN id(e) as existingEntityId").single();
	long newId = r.get("existingEntityId").asLong();
	transaction.commit();
	return newId;
}
 
Example 16
Source File: DynamicLabelsIT.java    From sdn-rx with Apache License 2.0 5 votes vote down vote up
@Override
Long createTestEntity(Transaction transaction) {
	Record r = transaction.run(""
		+ "CREATE (e:SimpleDynamicLabelsWithVersion:Foo:Bar:Baz:Foobar {myVersion: 0}) "
		+ "RETURN id(e) as existingEntityId").single();
	long newId = r.get("existingEntityId").asLong();
	transaction.commit();
	return newId;
}
 
Example 17
Source File: DynamicLabelsIT.java    From sdn-rx with Apache License 2.0 5 votes vote down vote up
@Override
Long createTestEntity(Transaction transaction) {
	Record r = transaction.run(""
		+ "CREATE (e:SimpleDynamicLabelsWithBusinessId:Foo:Bar:Baz:Foobar {id: 'E1'}) "
		+ "RETURN id(e) as existingEntityId").single();
	long newId = r.get("existingEntityId").asLong();
	transaction.commit();
	return newId;
}
 
Example 18
Source File: DynamicLabelsIT.java    From sdn-rx with Apache License 2.0 5 votes vote down vote up
@Override
Long createTestEntity(Transaction transaction) {
	Record r = transaction.run(""
		+ "CREATE (e:InheritedSimpleDynamicLabels:Foo:Bar:Baz:Foobar) "
		+ "RETURN id(e) as existingEntityId").single();
	long newId = r.get("existingEntityId").asLong();
	transaction.commit();
	return newId;
}
 
Example 19
Source File: ReactiveDynamicLabelsIT.java    From sdn-rx with Apache License 2.0 5 votes vote down vote up
@Override
Long createTestEntity(Transaction transaction) {
	Record r = transaction.run(""
		+ "CREATE (e:DynamicLabelsBaseClass:ExtendedBaseClass1:D1:D2:D3) "
		+ "RETURN id(e) as existingEntityId").single();
	long newId = r.get("existingEntityId").asLong();
	transaction.commit();
	return newId;
}
 
Example 20
Source File: ReactiveDynamicLabelsIT.java    From sdn-rx with Apache License 2.0 5 votes vote down vote up
@Override
Long createTestEntity(Transaction transaction) {
	Record r = transaction.run(""
		+ "CREATE (e:SimpleDynamicLabels:Foo:Bar:Baz:Foobar) "
		+ "RETURN id(e) as existingEntityId").single();
	long newId = r.get("existingEntityId").asLong();
	transaction.commit();
	return newId;
}