Return an array in a java application

Asked

Viewed 39 times

2

I’m making a java application that uses the neo4j database. One of the functions I call is to list all the contacts that have already been saved in the database, but I’m not able to implement the array to group these results and later give a "print". Would you like to know what I am doing wrong and how to do this implementation? Thanks from now on for the help.

    public void listar() {
    Session session = driver.session();
    ArrayList<String> greeting = new ArrayList();

     greeting = session.writeTransaction( new TransactionWork<String>() {
        @Override
        public ArrayList<String> execute(Transaction tx) {
            StatementResult result = tx.run("" +
                "MATCH (n:contatos) "+
                "RETURN n");

            return result.single().get(0).asString();
        }
    });  
    System.out.println(greeting );
}
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.