Orientdb: OrientDB 3.0 -.OCommandExecutionException: Cannot execute query on non idempotent statement:

Created on 16 Jun 2017  ·  4Comments  ·  Source: orientechnologies/orientdb

OrientDB Version:3.0

Java Version: 1.8

OS: Win 7

Expected behavior

should be able to delete vertex through queries.

Actual behavior

com.orientechnologies.orient.core.exception.OCommandExecutionException: Cannot execute query on non idempotent statement: DELETE VERTEX Market where id = ?
    DB name="mlm"
    at com.orientechnologies.orient.core.db.document.ODatabaseDocumentEmbedded.query(ODatabaseDocumentEmbedded.java:372)
    at com.orientdb.samples.test.MemoryDbDeleteTest.testCountryDelete(MemoryDbDeleteTest.java:58)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:108)
    at org.testng.internal.Invoker.invokeMethod(Invoker.java:661)
    at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:869)
    at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1193)
    at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:126)
    at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109)
    at org.testng.TestRunner.privateRun(TestRunner.java:744)
    at org.testng.TestRunner.run(TestRunner.java:602)
    at org.testng.SuiteRunner.runTest(SuiteRunner.java:380)
    at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:375)
    at org.testng.SuiteRunner.privateRun(SuiteRunner.java:340)
    at org.testng.SuiteRunner.run(SuiteRunner.java:289)
    at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
    at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
    at org.testng.TestNG.runSuitesSequentially(TestNG.java:1301)
    at org.testng.TestNG.runSuitesLocally(TestNG.java:1226)
    at org.testng.TestNG.runSuites(TestNG.java:1144)
    at org.testng.TestNG.run(TestNG.java:1115)
    at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:132)
    at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:230)
    at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:76)

Steps to reproduce

https://github.com/careerscale/orientdb-demo/blob/master/orientdb-java-sample/src/test/java/com/orientdb/samples/test/MemoryDbDeleteTest.java

question

Most helpful comment

Hi @careerscale

This is not a bug, the following row is invalid:

 graph.getRawDatabase().query("DELETE VERTEX Market where id = ?", 1);

DELETE VERTEX is a non-idempotent command, you have to use command() instead:

 graph.getRawDatabase().command("DELETE VERTEX Market where id = ?", 1);

Thanks

Luigi

All 4 comments

Hi @careerscale

This is not a bug, the following row is invalid:

 graph.getRawDatabase().query("DELETE VERTEX Market where id = ?", 1);

DELETE VERTEX is a non-idempotent command, you have to use command() instead:

 graph.getRawDatabase().command("DELETE VERTEX Market where id = ?", 1);

Thanks

Luigi

@luigidellaquila , is this only for DELETE or for create too? even that won't be idempotent right?

basiscally for all DDL (as in SQL) command shoul dbe used, is this right thing to say?

Hi @careerscale

As a general rule, you can use query() for SELECT, MATCH and TRAVERSE. For all the rest you have to use command()

Thanks

Luigi

Hi @careerscale

As a general rule, you can use query() for SELECT, MATCH and TRAVERSE. For all the rest you have to use command()

Thanks

Luigi

Was this page helpful?
0 / 5 - 0 ratings