[Neo4j] Neo4j tutorial

Axel Morgner axel at morgner.de
Tue Oct 26 11:24:54 CEST 2010


You forgot tx.success() in the try{} block, see 
http://wiki.neo4j.org/content/Transactions#Controlling_success.

Greetings

Axel

Am 26.10.2010 11:19, schrieb Roman Uhlig:
> Hi,
> I'm completely new to Neo4j and got an issue while trying the getting started guide.
>
> Everytime I close the database (GraphDatabaseService.shutdown()) and open it again later, all data is gone (or was never saved). I did exactly as described in the guide, so maybe someone can point me in the right direction? Probably just some stupid mistake by me. ;)
>
> My tiny test case (Windows, Java 1.6):
>
> Writing data:
>
> GraphDatabaseService db = new EmbeddedGraphDatabase("/temp/neo4j/test1");
> try {
> 	org.neo4j.graphdb.Transaction tx = db.beginTx();
> 	try {
> 		Node rootNode = db.getReferenceNode();
> 		Node firstNode = db.createNode();
> 		rootNode.createRelationshipTo(firstNode, IdabaRelTypes.ROOT_TYPES);
> 	} finally {
> 		tx.finish();
> 	}
> } finally {
> 	db.shutdown();
> }
>
> Reading data:
>
> GraphDatabaseService db = new EmbeddedGraphDatabase("/temp/neo4j/test1");
> try {
> 	org.neo4j.graphdb.Transaction tx = db.beginTx();
> 	try {
> 		Node rootNode = db.getReferenceNode();
> 		for (Relationship rel : rootNode.getRelationships()) {
> 			// output test data, but nothing in it
> 		}
> 	} finally {
> 		tx.finish();
> 	}
> } finally {
> 	db.shutdown();
> }
>
>
> Thanks in advance,
> Roman
> _______________________________________________
> Neo4j mailing list
> User at lists.neo4j.org
> https://lists.neo4j.org/mailman/listinfo/user


-- 
Axel Morgner
Creative Solutions - Software Engineering
GUI&  UX Design - Project Management

c/o inxire GmbH
Hanauer Landstr. 293a
60314 Frankfurt
Germany

Phone +49 151 40522060
E-mail axel at morgner.de
Web http://morgner.de



More information about the User mailing list