Erro on addVertex when upgrading from 2.2.15 to 2.2.21

17 views
Skip to first unread message

MikeH.

unread,
Jun 14, 2017, 5:33:57 AM6/14/17
to OrientDB
Hi,

I'm upgrading a system Play application that uses Java not Scala from Orientdb-2.2.15 to orientdb-2-2-21 and I'm having a problem with addVertex and need advice where to investigate (or to point out our novice error).  The error we get is in our unit tests where each test starts OrinetDB as an embedded server using an in-memory "testDb".

Here's the wrapper code for the update :

OrientGraphConnectionHandlerIF connPool;
       
@Inject
public GraphTransactionManager(OrientGraphConnectionHandlerIF connHandler) {
           connPool = connHandler;
}

        public T runWithCommit(withGraphConnection<T> runnable) {
             
                FramedGraph<OrientGraph> graph = connPool.getFrameGraph();
             T result = null;
               try {
                  result = runnable.run(graph);
                  graph.getBaseGraph().commit();
         } catch(Exception e) {
                 graph.getBaseGraph().rollback();
                       Logger.error(String.format("Error in graph transaction manager while running with commit: "), e);
           throw e;
          } finally {
                    graph.getBaseGraph().shutdown();
               }      
                return result;
         
       }



And here's lambda code that fails (arrHandler is an instance of the above where the Template T is an array).  I've commented the line 71 and 74 mentioned in the stack trace shown later:


    @Override
   public DeletionDTO createDeletionFromInstance(String instanceId, DeletionDTO deletionDTO) throws Exception {

        return handler.runWithCommit((graph) -> {                                                          //this is line 71

            // create and map the initial values
           DeletionGraph deletionGraph = graph.addVertex( "class:DeletionGraph", DeletionGraph.class);    // this is line 74

            //set the status and ID (this will overwrite anything set in the DTO)
           deletionGraph.setUniqueIdentifier( deletionGraph.generateUniqueIdentifier() );
           deletionGraph.setDeletionStage( DeletionStatus.NEW_UNCOMMITTED.getStatus());

            //get the mandatory fields
           deletionGraph.setUniqueIdentifier( deletionGraph.getUniqueIdentifier());
           deletionGraph.setDeletionType( deletionDTO.getDeletionType().toString());
           deletionGraph.setDeletionApprovalDate( deletionDTO.getDeletionApprovalDate());
           deletionGraph.setDDFReference( deletionDTO.getDDFReference());
           deletionGraph.setDeletionDescription( deletionDTO.getDeletionDescription());

            //add the actors
           deletionGraph.setCreatedBy(createActor(deletionDTO.getCreatedBy(), graph));

            //assign the asset instance edge/adjacency
           Iterable<AssetInstanceGraph> foundAssetInstances = graph.getVertices( "AssetInstance." + UNIQUE_IDENTIFIER, instanceId, AssetInstanceGraph.class);
           AssetInstanceGraph assetInstance = foundAssetInstances.iterator().hasNext() ? foundAssetInstances.iterator().next() : null;
           deletionGraph.setDeletionFor( assetInstance );

            return new DeletionDTO(deletionGraph);
       });
   }



The stack trace appears to show the record being saved at line 74 when running with OrientDb 2.2.15 it did not. 

DB name="testdb"
       at com.orientechnologies.orient.core.record.impl.ODocument.validateField(ODocument.java:229)
   at com.orientechnologies.orient.core.record.impl.ODocument.validate(ODocument.java:2047)
       at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.save(ODatabaseDocumentTx.java:2733)
       at com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.save(ODatabaseDocumentTx.java:102)
at com.orientechnologies.orient.core.record.impl.ODocument.save(ODocument.java:1805)
   at com.orientechnologies.orient.core.record.impl.ODocument.save(ODocument.java:1796)
   at com.tinkerpop.blueprints.impls.orient.OrientElement.save(OrientElement.java:333)
    at com.tinkerpop.blueprints.impls.orient.OrientElement.save(OrientElement.java:315)
    at com.tinkerpop.blueprints.impls.orient.OrientBaseGraph.addVertex(OrientBaseGraph.java:571)
   at com.tinkerpop.blueprints.impls.orient.OrientBaseGraph.addVertex(OrientBaseGraph.java:503)
   at com.tinkerpop.blueprints.impls.orient.OrientBaseGraph.addVertex(OrientBaseGraph.java:75)
    at com.tinkerpop.frames.FramedGraph.addVertex(FramedGraph.java:242)
    at com.tinkerpop.frames.FramedGraph.addVertex(FramedGraph.java:258)
    at services.implementations.deletionservice.DeletionServiceImpl.lambda$createDeletionFromInstance$3(DeletionServiceImpl.java:74)
       at modules.database.graph.connection.GraphTransactionManager.runWithCommit(GraphTransactionManager.java:31)
    at services.implementations.deletionservice.DeletionServiceImpl.createDeletionFromInstance(DeletionServiceImpl.java:71)
```




Any ideas would be much appreciated.

MikeH.

Reply all
Reply to author
Forward
0 new messages