1

Wondering if there is a configuration i need for my transaction so that its not read only...

I get an error when creating a node in a procedure. The error is Caused by: org.neo4j.graphdb.security.AuthorizationViolationException: Write operations are not allowed for READ transactions.

Test that calls the procedure is -

@Test
public void testLoad() throws Exception {

    GraphDatabaseService db = new           TestGraphDatabaseFactory().newImpermanentDatabase();

    ((GraphDatabaseAPI) db).getDependencyResolver().resolveDependency(Procedures.class)
            .register(LiveServiceLoad.class);

    Result res = db.execute("CALL load.hello()");

}

Procedure that causes error -

 @Procedure 
public Stream<Output> loadTimeTable() {
 try ( Transaction tx = db.beginTx() )
        {
         Node liveServiceNode = db.createNode(Label.label("LiveService"));
Phil
  • 21
  • 3

1 Answers1

0

You need to add the @PerformsWrite annotation to any procedure doing mutating operations on the graph.

See https://github.com/neo4j-contrib/neo4j-apoc-procedures/blob/master/src/main/java/apoc/create/Create.java#L27 as an example.

Stefan Armbruster
  • 39,465
  • 6
  • 87
  • 97