You have to wrap your operation in a transaction:

http://docs.neo4j.org/chunked/stable/tutorials-java-embedded-hello-world.html#_wrap_operations_in_a_transaction

Am 04.03.2014 um 21:32 schrieb Ruby <[email protected]>:

> So I have a program, whereby I create all the nodes and add relationships 
> from and to them. When creating these nodes they are stored in nodes_created, 
> for me to then use in relationship creation.
> 
> 
>         for(Map.Entry<String[], Integer> entry: 
> company_counts_backward.entrySet()){
>             String[] node_names  = entry.getKey();
>             String company_from = node_names[0];
>             String company_to = node_names[1];
> 
>             int count = entry.getValue();
>             Node companyFromNode = nodes_created.get(company_from);
>             Node companyToNode = nodes_created.get(company_to);
>             Relationship relationship = 
> companyFromNode.createRelationshipTo(companyToNode, Relations.WORKED_AT);
>             relationship.setProperty("relationship-type", "knows");
>             relationship.setProperty("length", count);
>         }
> 
> However at the line: `Relationship relationship = 
> companyFromNode.createRelationshipTo(companyToNode, Relations.WORKED_AT);` I 
> am getting an exception: `Exception in thread "main" 
> org.neo4j.graphdb.NotInTransactionException`
> 
> Anyone know what causes this and what I am doing incorrectly? 
> 
> -- 
> 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/groups/opt_out.

-- 
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/groups/opt_out.

Reply via email to