Please call tx.close() where the actual commit happens. tx.success() just
marks it as successful. And make sure tx.close() is called in a finally
block, or that the Transaction is a resource in a try-with-resource block.

On Thu, Sep 18, 2014 at 11:19 AM, Sukaant Chaudhary <
sukaant.chaudh...@gmail.com> wrote:

> It is not giving any error also, but nodes are not created in the db.
> Please help if anyone have any idea about this.
>
> -Sukaant Chaudhary
> <http://in.linkedin.com/pub/sukaant-chaudhary/33/ba8/479>
>
> On Thu, Sep 18, 2014 at 11:43 AM, Sukaant Chaudhary <
> sukaant.chaudh...@gmail.com> wrote:
>
>> Hi,
>> I'm using the following code. Please suggest why it is not creating the
>> nodes.
>>
>>             GraphDatabaseService db = new GraphDatabaseFactory()
>>                 .newEmbeddedDatabase(NEO4J_DB_PATH);
>>             ExecutionEngine engine = new ExecutionEngine(db);
>>             Transaction transaction = db.beginTx();
>>             ExecutionResult result;
>>             String query = "MERGE (ad:Ad {name: {name}, date: {date}}) ON
>> MATCH SET ad.reach = ad.reach + {reach}, ad.totalViewTime =
>> ad.totalViewTime + {totalViewTime} ON CREATE SET ad.reach = {reach},
>> ad.totalViewTime = {totalViewTime} RETURN ad";
>>             Map<String, Object> paramValues = new HashMap<String,
>> Object>();
>>             paramValues.put("name", adNodePojo.getName());
>>             paramValues.put("date", adNodePojo.getDate());
>>             paramValues.put("reach", adNodePojo.getReach());
>>             paramValues.put("totalViewTime",
>> adNodePojo.getTotalViewTime());
>>
>>             result = engine.execute(query, paramValues);
>>
>>             Iterator<Node> column =
>> result.columnAs(AD_NODE_PROPERTY_NAME);
>>
>>             for (Node node : IteratorUtil.asIterable(column)) {
>>                 System.out.println("Node: " + node);
>>                 System.out.println("Name: " + ": " +
>> node.getProperty("name"));
>>                 System.out.println("Date: " + ": " +
>> node.getProperty("date"));
>>                 System.out
>>                         .println("Reach: " + ": " +
>> node.getProperty("reach"));
>>                 System.out.println("View: " + ": "
>>                         + node.getProperty("totalViewTime"));
>>             }
>>             transaction.success();
>>
>>
>> -Sukaant Chaudhary
>> <http://in.linkedin.com/pub/sukaant-chaudhary/33/ba8/479>
>>
>
>  --
> 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 neo4j+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Mattias Persson
Neo4j Hacker at Neo Technology

-- 
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 neo4j+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to