Neo4j + Eclipse [message #1385344] |
Thu, 05 June 2014 18:13 |
Danny Alex Lachos Perez Messages: 1 Registered: June 2014 |
Junior Member |
|
|
I have the following code (Using Eclipse with sample database Neo4j DataBase -"Movie") which returns the name and born of the actors of the film "The Matrix":
String query = "match (a:Person)-->(m {title:'The Matrix'}) return a.name,a.born;"
final String txUri = SERVER_ROOT_URI + "transaction/commit";
WebResource resource = Client.create().resource( txUri );
String payload = "{\"statements\" : [ {\"statement\" : \"" +query + "\"} ]}";
ClientResponse response = resource
.accept( MediaType.APPLICATION_JSON )
.type( MediaType.APPLICATION_JSON )
.entity( payload )
.post( ClientResponse.class );
System.out.println(response.getEntity( String.class ));
The result is:
{"results":[{"columns":["a.name","a.born"],"data":[{"row":["Keanu Reeves",1964]},{"row":["Carrie-Anne Moss",1967]},{"row":["Laurence Fishburne",1961]},{"row":["Hugo Weaving",1960]},{"row":["Andy Wachowski",1967]},{"row":["Lana Wachowski",1965]},{"row":["Joel Silver",1952]},{"row":["Emil Eifrem",1978]}]}],"errors":[]}
But now i want to
now I want to pass data to a list, for example:
public class Person {
String name;
int born;
}
java.util.List<Person> lstPerson = new java.util.ArrayList<Person>();
As I load the results of response.getEntity( String.class ) to my list or would be a better way of working using Eclipse?
Thank you
|
|
|
Powered by
FUDForum. Page generated in 0.02214 seconds