OrientDB creates a vertex type

I am working with OrientDB with the Java API. I have this warning and I don’t understand why:

The command "create vertex type" "User" as a subclass of "V" must be executed outside the active transaction: the transaction will be completed and will open again immediately after it. To avoid this behavior, execute it outside the transaction

My Java code is:

OrientGraph graph = new OrientGraphFactory(databaseUrl).getTx();
graph.createVertexType(User.CLASS_NAME);
graph.createKeyIndex(User.MAIL_KEY, Vertex.class, new Parameter<>("type", "UNIQUE"),new Parameter<>("class", User.CLASS_NAME));
graph.commit();
graph.shutdown();
+4
source share
1 answer

The solution is to use a databaseless transaction. Your first line should be:

OrientGraphNoTx graph = new OrientGraphFactory(databaseUrl).getNoTx();

OrientGraphNoTx , OrientGraph. , , , ( , . , ). , , .

+3

Source: https://habr.com/ru/post/1621725/


All Articles