user3314986
user3314986

Reputation: 13

Relationships don't show in neo4j web browser when created by api...neo4j 2.0.1

I have created a simple test in the java api (see below). I then set the neo4j-server.properties to that db and restart neo4j. I'm expecting to see two nodes and a relationship using the web browser localhost:7474/browser.

When code below is executed, the for loop does detect a relationship, however it does not display (nor are they returned by CYPHER query) in the browser.

I'm using 2.0.1 in the java and neo4j server. Is my expectation in error?

Transaction tx = gdb.beginTx();
    try
    {
     Label courseLabel = DynamicLabel.label( "Book" );
     Label courseLabelP = DynamicLabel.label( "Person" );
     Node a = gdb.createNode(courseLabel), b = gdb.createNode(courseLabelP);
     Relationship rel = a.createRelationshipTo( b, CourseRelTypes.HAS_AUTHOR );
        for(Relationship r : b.getRelationships(CourseRelTypes.HAS_AUTHOR)) {
            System.out.println("has rel");
          }
    }
    finally {
        tx.close();
    }

Upvotes: 1

Views: 149

Answers (1)

Luanne
Luanne

Reputation: 19373

You need to do a tx.success() to commit that transaction

Upvotes: 2

Related Questions