Validate a org.neo4j.driver.v1.StatementResult

9 views
Skip to first unread message

Davide D'Alto

unread,
Oct 19, 2016, 5:24:09 AM10/19/16
to Neo4j
Hi,
Is there a way to validate the response obtain via Bolt using the neo4j-java-driver?

At the moment, I'm using the following approach:

StatementResult result = tx.run(...);
result.hasNext():

The hasNext method will generate an exception in case an error occured on the remote server (for example a unique constraint violation).

Is this the right approach?

Thanks,
Davide

Michael Hunger

unread,
Oct 19, 2016, 5:34:55 AM10/19/16
to ne...@googlegroups.com
Hi Davide,

there are two levels. One is syntactic query checking which you can also get by prefixing the query with EXPLAIN and then look for errors and also notifications.

The other as you said is to run it (possibly in a tx that you might want to roll back).

In general make sure to consume / close the result you get back.

Michael


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

Davide D'Alto

unread,
Oct 19, 2016, 5:36:37 AM10/19/16
to ne...@googlegroups.com
Thanks
>> email to neo4j+un...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>
>
> --
> 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/36jgbAgHSN8/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> neo4j+un...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages