[英]Tinkerpop frame: how to create new Vertex
我無法使用Tinkerpop Frame和Blueprint(2.6版)保留新的頂點。 我究竟做錯了什么? 這是我的代碼..從沒有用的部分中清除一點。 我使用OrientDb作為令人討厭的Graph數據庫引擎。
我沒有收到任何異常,但是當我查看數據庫時它是空的。 你能注意到為什么嗎? 謝謝!
框架實體:
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);
}
用戶管理器類:
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();
}
我很確定您需要提交交易。
您可以嘗試使用FramedTransactionalGraph嗎?
FramedTransactionalGraph<OrientGraph> framedGraph = framedFactory.create(instance);
....Code....
framedGraph.commit();
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.