Hi Suresh Bojjam,
the following code snippet should work:
IClause[] clauses;
JcQuery query;
String cypher;
JcNode user = new JcNode("user");
JcNumber id = new JcNumber("_id");
clauses = new IClause[]{
MERGE.node(user)
.property("NAME").value("Suresh")
.property("MYID").value("123")
.label("User"),
RETURN.value(user.id()).AS(id)
};
query = new JcQuery();
query.setClauses(clauses);
BigDecimal idResult = null;
JcQueryResult result = dbAccess.execute(query);
if (!result.hasErrors()) {
idResult = result.resultOf(id).get(0);
}
best regards,
Wolfgang
On Wed, Nov 15, 2017 at 9:11 AM, suresh bojjam <[email protected]>
wrote:
> Hi Wolfgang Schuetzelhofer,
>
> I am trying to explore JCypher with layer "JCypher-Query-DSL".
> How can we get the newly created Node id from JCypher? please look at the
> below is the snippet.
>
> query1.setClauses(new IClause[] {
> MERGE.node(user)
> .property("NAME").value("Suresh")
> .property("MYID").value("123")
> .label("User")
> //.relation().property("NAME").value("Access").out().node(table)
> });
>
> JcQueryResult result=executeQuery(query1);
> if(result!=null) {
> ObjectMapper mapper=new ObjectMapper();
> System.out.println("result: "+mapper.writeValueAsString(result));
> }else{
> System.out.println("Null Result");
> }
> JcNumber id=user.id().asNumber();
> System.out.println("user.id(): "+id.asString());
>
> thanks,
> suresh
>
> On Monday, July 31, 2017 at 11:08:08 PM UTC+5:30, Wolfgang Schuetzelhofer
> wrote:
>>
>> Hi everybody,
>>
>> *JCypher* *3.8.0 *has been released.
>>
>> New in this release:
>>
>> - Support for Neo4j 3.2.2.
>> - Shutdown hooks in IDBAccess optional
>> - Public constructors for IDBAccess implementations allow more
>> flexibly customizable configurations. Although you are highly encouraged
>> to
>> use DBAccessFactory, you are no longer forced to do so.
>>
>> For what's new in JCypher,
>> you may also want to have a look at the *release notes
>> <https://github.com/Wolfgang-Schuetzelhofer/jcypher/blob/master/release_notes.md>.*
>> If you are interested about what will be in the next release(s), please
>> have a look at *Outlook (Roadmap)*
>> <https://github.com/Wolfgang-Schuetzelhofer/jcypher/wiki/Outlook-(Roadmap)>
>> .
>> For a complete overview please start at JCypher's *Project Home Page
>> <http://jcypher.iot-solutions.net/>.*
>>
>> best regards,
>> Wolfgang Schuetzelhofer
>>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Neo4j" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/neo4j/-gVYsTmLoro/unsubscribe.
> To unsubscribe from this group and all its topics, 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.