orientdbtinkerpoptinkerpop-blueprinttinkerpop-frames

Tinkerpop frame: how to create new Vertex


I can't persist a new vertex with Tinkerpop Frame and Blueprint (ver. 2.6). What am I doing wrong? This is my code.. a little cleaned from parts that are not useful. I am using OrientDb as undelying Graph database engine.

I receive no exception, but when I look in the database it is empty. Can you notice why? Thank you!

Frame entity:

public interface User extends VertexFrame{

@Property("id")
public String getId();
@Property("id")
public void getId(String Id);

@Property("email")
public String getEmail();
@Property("email")
public void setEmail(String email);

@Property("password")
public String getPassword();
@Property("password")
public void getPassword(String providerId);

@Property("firstName")
public String getFirstName();
@Property("firstName")
public void setFirstName(String firstName);
}

User Manager class:

public class UserManager implements Serializable {
    FramedGraphFactory framedFactory = new FramedGraphFactory();
    OrientGraphFactory graphFactory = new OrientGraphFactory("remote:192.168.50.10:2424/database", "user", "pass");
    OrientGraph instance = graphFactory.getTx();
    FramedGraph<OrientGraph> framedGraph = framedFactory.create(instance);


    User user = framedGraph.addVertex(UUID.randomUUID(), User.class);
    user.setFirstName(profile.getFirstName());
    user.setLastName(profile.getLastName());


    OrientVertex u = (OrientVertex) user.asVertex();
    u.save();
}

Solution

  • I'm pretty sure you need to commit the transaction.

    Can you try using FramedTransactionalGraph?

    FramedTransactionalGraph<OrientGraph> framedGraph = framedFactory.create(instance);
    
    ....Code....
    
    framedGraph.commit();