Skip to content

Error on creation of new edge with remote database API (NullPointerException) #1068

@lvca

Description

@lvca

(This issue comes from the Discord channel)

Step to reproduce it

public void saveLibrary() {
        try (RemoteDatabase database = new RemoteDatabase("localhost", 2480, "testdb", "root", "playwithdata")) {
            Person personOne = new Person();
            personOne.setPersonId(UUID.randomUUID().toString());
            personOne.setName("personOne");

            LibraryModel library = new LibraryModel();
            library.setLibraryId(UUID.randomUUID().toString());
            library.setName("library");
            library.setLibraryPerson(List.of(personOne));

            MutableVertex libraryVertex = database.newVertex("Library");
            libraryVertex.set("libraryId", library.getLibraryId(), "name", library.getName());
            libraryVertex.save();


            MutableVertex personOneVertex = database.newVertex("Person");
            personOneVertex.set("personId", personOne.getPersonId(), "name", personOne.getName());
            personOneVertex.save();

            libraryVertex.newEdge("HavePerson", personOneVertex, false);
        }
    }

This is a very simple example. I created two classes and made a small scheme that run immediately when the application starts

create vertex type Library if not exists;

create property Library.libraryId if not exists string;
create property Library.name if not exists string;
create edge type HavePerson if not exists;

create vertex type Person if not exists;
create property  Person.personId if not exists string;
create property  Person.name if not exists string;

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions