Dont find any simple example in documentation how access graphdb with new 
api. Am i correct? Witch is prefer? 

public class Register extends Controller {
    static OrientGraphFactory dbFactory = new 
OrientGraphFactory("plocal:/Users/recoilme/tmp/db").setupPool(1,10);

    public static void save(String email, String password, boolean 
remember) {
        OrientGraph graph = dbFactory.getTx();
        try {
            graph.addVertex( "class:User", "email", email, "password", 
password, "remember", remember);
            graph.commit();

            //1st sposob
            OrientGraphQuery oQuery = (OrientGraphQuery) graph.query();
            Iterable<Vertex> results1 = oQuery.labels("User").has("email", 
email).vertices();
            for (Vertex v: results1) {
                
System.out.println("Vertex1:"+v.toString()+v.getProperty("password"));
            }
            //2 sposob
            for( Vertex v : graph.getVertices("User.email", email) ) {
                System.out.println("Vertex2: " + v );
            }
            //3 sposob
            Iterable<Vertex> results2 = graph.command(new 
OCommandSQL("select from User where email = '" + email + "'")).execute();
            for (Vertex v: results2) {
                
System.out.println("Vertex3:"+v.toString()+v.getProperty("password"));
            }
            //gremlin?
        }
        catch (Exception e) {
            System.out.println("Ex:"+e.toString());
            graph.rollback();
        }
        finally {
            graph.shutdown();
        }
    }
}


-- 

--- 
You received this message because you are subscribed to the Google Groups 
"OrientDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to