Hi All,
I have an existing neo4j database and i have created an index named "idIndex"(when i created the database). I am connecting to the existing database and trying to retrieve a node using the getSingle() function in the following way,
but none of the nodes are being able to be retrieved. However, when i tried to retrieve the nodes in the same transaction, where i created the database, i was able to retrieve.
Here is my code
//I assume this will open the existing database
graphDb = new GraphDatabaseFactory().newEmbeddedDatabase(DB_PATH);
registerShutdownHook(graphDb) ;
Transaction tx = graphDb.beginTx();
try{
//it says the index exists
boolean exists = graphDb.index().existsForNodes("idIndex");
if(exists)
System.out.println("Index exists");
//I assume this gives the handle to the existing index
Index<Node> idIndex = graphDb.index().forNodes("idIndex");
//retrieve the node by key and value
Node NodeA = idIndex.get("name","54O").getSingle();
Node NodeB = idIndex.get("name","32I").getSingle();
}
finally
{
tx.finish();
}
Could anyone please help me to understand what is going wrong here?
Thanks,
Salini S
--