You need transactions around your operations, see: 
http://docs.neo4j.org/chunked/stable/tutorials-java-embedded-hello-world.html#_wrap_operations_in_a_transaction

And keeping references to your nodes / rels in variables won't help you a lot 
as you still need transactions for reading from them.

Cheers,

Michael

----
(michael}-[:SUPPORTS]->(YOU)-[:USE]->(Neo4j)
Learn Online, Offline or Read a Book (in Deutsch)
We're trading T-shirts for cool GraphGist Models





Am 09.03.2014 um 22:13 schrieb Khadidja Tihar <[email protected]>:

> Hi,
> I use twitter4j with neo4j, i try to insert index but it doesn't work, i have 
> this error :
> at 
> org.neo4j.kernel.impl.transaction.AbstractTransactionManager.assertInTransaction(AbstractTransactionManager.java:84)
>       at 
> org.neo4j.kernel.impl.coreapi.IndexManagerImpl.assertInTransaction(IndexManagerImpl.java:466)
>       at 
> org.neo4j.kernel.impl.coreapi.IndexManagerImpl.forNodes(IndexManagerImpl.java:301)
>       at 
> org.neo4j.kernel.impl.coreapi.IndexManagerImpl.forNodes(IndexManagerImpl.java:294)
> 
> this is my code:
> 
> private void createDB()
>       {
>               _graphDB = new 
> GraphDatabaseFactory().newEmbeddedDatabase(DB_PATH);
>                 System.out.println("bd acces"+_graphDB);
>                         
>               _entitiesIndex= _graphDB.index().forNodes( "twitterEntities" );
>                 System.out.println("index entite ajoutée : \n"+_graphDB);
>                _UserIndex= _graphDB.index().forNodes( "User" ); 
>               _TwittIndex= _graphDB.index().forNodes( "Twitt" ); 
>                _URLIndex = _graphDB.index().forNodes( "URL" );
>               _HashtagIndex= _graphDB.index().forNodes( "Hashtag" ); 
>               _MediaIndex= _graphDB.index().forNodes( "Media" ); 
> 
>               _relMENTION = _graphDB.index().forRelationships("Mention");
>               _relTWITT = _graphDB.index().forRelationships("Twitt");
>               _relHASHTAG = _graphDB.index().forRelationships("Hashtag");
>               _relURL = _graphDB.index().forRelationships("URL");
>               _relMEDIA = _graphDB.index().forRelationships("Media");
>               _relRT = _graphDB.index().forRelationships("RT");
> 
>               WrappingNeoServerBootstrapper srv;
>               srv = new WrappingNeoServerBootstrapper((GraphDatabaseAPI)  
> _graphDB );
>               srv.start();
> 
>       }
> 
> thank you 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Neo4j" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Neo4j" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to