What i am trying to do is getOrCreateVertex i.e. get if the vertex is present otherwise create it. but when I hit this query v=g.V().has(idKey,idVal).tryNext().orElseGet{ graph.addVertex(T.label,vertexTypeValue, __key_customer_id, __val_customer_id);graph.tx().commit();};g.V().has(idKey,idVal);
I get the following error/exception
179127052 [gremlin-server-exec-8] WARN org.apache.tinkerpop.gremlin.server.op.AbstractEvalOpProcessor - Exception processing a script on request [RequestMessage{, requestId=be67d041-613e-11e6-89a5-4703f811502a, op='eval', processor='', args={gremlin=
v=g.V().has(idKey,idVal).tryNext().orElseGet{ graph.addVertex(T.label,vertexTypeValue, __key_customer_id, __val_customer_id);graph.tx().commit();};g.V().has(idKey,idVal);
,
bindings={__key_c ustomer_id=customer_id, __val_customer_id=71888724, vertexTypeValue=customer, hasString=__key_customer_id, __val_customer_id, idKey=customer_id, id Val=71888724},
accept=application/json, language=gremlin-groovy}}]. com.thinkaurelius.titan.core.SchemaViolationException: Adding this property for key [customer_id] and value [71888724] violates a uniqueness constraint [customer_id]
Not able to figure out why an exception even after taking it into consideration in query itself