Search code examples
javaarcadedb

Update a Vertex after Retrieving it


String queryPositional="SELECT FROM TestVtx WHERE $xy_io=?";
        rs=db.command("sql", queryPositional, "30");
        while(rs.hasNext()){

            Vertex vtx=rs.next().getVertex().get();
            System.out.println(vtx.toJSON());
            System.out.println(vtx.getClass().getName());//RoteImmutableVertex
//vtx.setProperty("name","value"); vtx.save(); --> No method to update
            
}

What is the way to update the retrieved vertex in ArcadeDB


Solution

  • In ArcadeDB vertices coming from a query are immutable (unless already modified in the transaction). The right way is to call .modify():

    vtx.modify().set("name","value").save();