Retrieving OrientVertex Objects from OrientDB
graph-databases, gremlin, orientdb, tinkerpop-blueprint
Solution
Looking at your code, you are using the Graph API. After calling `getRawGraph()` you are not working with the Graph API any more, but with the Document API (method name is a little bit confusing).
Having a reference to the `OrientGraph` there are several possibilities
- Using `orientGraph#getVertex*(..)` / `orientGraph#getVertices*(..)`style of methods
- Using a Query object: `orientGraph#query().has("key", value).vertices()`
- Using the gremlin query language
- Using `orientGraph#command(...).execute()`. In this case the command is executed outside the transaction (thanks @wolf4ood)
Problem
I'm having trouble with the Graph API of OrientDB in Java. Problem: Retrieve Vertices (OrientVertex or Vertex?) from a persistent local graph database with several Vertices/Edges created via the console. So for, I've been able to query the database from what I now think is the Document API using ``` graph = factory.getTx(); String string = String.format("select * from V where name like \"%s\"", criteria); OSQLSynchQuery<ODocument> query = new OSQLSynchQuery<OrientVertex>(string); List<OrientDocument> results = graph.getRawGraph().command(query).execute(); ``` But this will not work for Vertices. How do I run queries that return a list of Vertices in my database? Thanks in advance.