1

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();
}
Andrea T
  • 3,035
  • 4
  • 23
  • 39

1 Answers1

1

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

Can you try using FramedTransactionalGraph?

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

....Code....

framedGraph.commit();
Bryn
  • 487
  • 3
  • 11
  • Also if this is a green fields project then take a look at [Totorom](https://github.com/BrynCooke/totorom). It is the spiritual successor to Frames. (Disclaimer I am the developer of Totorom) – Bryn Oct 01 '14 at 12:56
  • Correct. Thank you! :) Now the problem is updating Vertexes converted to Entities with Frames but detached from the db.. do you have any suggestion for the best practice? http://stackoverflow.com/questions/26187415/what-is-the-best-practice-to-update-a-vertex-after-is-detached-from-db-with-tink – Andrea T Oct 03 '14 at 22:05