Search in sources :

Example 1 with Visit

use of org.neo4j.ogm.domain.travel.Visit in project neo4j-ogm by neo4j.

the class CompilerTest method shouldMergeNewRelationshipEntity.

@Test
public void shouldMergeNewRelationshipEntity() throws Exception {
    Person frantisek = new Person("Frantisek");
    Place scotland = new Place("Scotland");
    Visit visit = frantisek.addVisit(scotland, "Holiday");
    Compiler compiler = mapAndCompile(frantisek, -1);
    List<Statement> statements = compiler.createRelationshipsStatements();
    assertThat(statements).extracting(Statement::getStatement).containsOnly("UNWIND $rows as row " + "MATCH (startNode) WHERE ID(startNode) = row.startNodeId WITH row,startNode " + "MATCH (endNode) WHERE ID(endNode) = row.endNodeId " + "MERGE (startNode)-[rel:`VISITED` {`identifier`: row.props.`identifier`}]->(endNode) " + "SET rel += row.props " + "RETURN row.relRef as ref, ID(rel) as id, $type as type");
}
Also used : Visit(org.neo4j.ogm.domain.travel.Visit) Statement(org.neo4j.ogm.request.Statement) Person(org.neo4j.ogm.domain.travel.Person) Place(org.neo4j.ogm.domain.travel.Place) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 Person (org.neo4j.ogm.domain.travel.Person)1 Place (org.neo4j.ogm.domain.travel.Place)1 Visit (org.neo4j.ogm.domain.travel.Visit)1 Statement (org.neo4j.ogm.request.Statement)1