Java 在OrientDB的事务图中添加带框架的类型化顶点
早上好 我正试图在事务模式下使用orientDB graph,我不知道为什么,但我的所有顶点都不是用我在创建时设置的代理类类型保存的 这是我的密码:Java 在OrientDB的事务图中添加带框架的类型化顶点,java,orientdb,vertex,transactional,tinkerpop,Java,Orientdb,Vertex,Transactional,Tinkerpop,早上好 我正试图在事务模式下使用orientDB graph,我不知道为什么,但我的所有顶点都不是用我在创建时设置的代理类类型保存的 这是我的密码: FramedGraphFactory framedFactory = new FramedGraphFactory(); OrientGraph instance = graphFactory.getTx(); FramedTransactionalGraph<OrientGraph> framedGraph=framedFactory
FramedGraphFactory framedFactory = new FramedGraphFactory();
OrientGraph instance = graphFactory.getTx();
FramedTransactionalGraph<OrientGraph> framedGraph=framedFactory.create(instance);
(getGraph是我的类中返回FramedTransactionalGraph的方法)
社交用户接口
public interface SocialUser extends VertexFrame {
@Property("socialId")
void setSocialId(String socialId);
@Property("socialId")
String getSocialId();
@Property("valid")
void setValid(boolean valid);
@Property("valid")
boolean getValid();
@Property("creationDate")
void setCreationDate(Date creationDate);
@Property("creationDate")
Date getCreationDate();
@Property("lastLoginDate")
void setLastLopginDate(Date lastLoginDate);
@Property("lastLoginDate")
Date getLastLoginDate();
@Property("status")
void setStatus(String status);
@Property("status")
String getStatus();
@Property("info")
public void setUserInfo(Map<String, String> userInfo);
@Property("info")
public Map<String, String> getUserInfo();
@Adjacency(label = "usersEdge", direction = Direction.BOTH)
PhysicUser getPhysicUser();
@Adjacency(label = "usersEdge", direction = Direction.BOTH)
void setPhysicUser(PhysicUser physicUser);
@Adjacency(label = "userUvi", direction = Direction.BOTH)
public Iterable<Uvis> getUvis();
@Adjacency(label = "userUvi", direction = Direction.BOTH)
public void setUvis(Uvis uvis);
@Property("uvi")
public String getCurrentUvi();
@Property("uvi")
public void setCurrentUvi(String uvi);
公共接口SocialUser扩展VertexFrame{
@财产(“社会性”)
void setSocialId(字符串socialId);
@财产(“社会性”)
字符串getSocial();
@财产(“有效”)
void setValid(布尔有效);
@财产(“有效”)
布尔getValid();
@财产(“创制物”)
无效设定日期(设定日期);
@财产(“创制物”)
日期getCreationDate();
@地产(“lastLoginDate”)
作废setLastLopginDate(日期lastLoginDate);
@地产(“lastLoginDate”)
日期getLastLoginDate();
@财产(“地位”)
无效设置状态(字符串状态);
@财产(“地位”)
字符串getStatus();
@财产(“信息”)
公共void setUserInfo(映射userInfo);
@财产(“信息”)
公共地图getUserInfo();
@邻接(label=“usersEdge”,direction=direction.BOTH)
PhysicUser getPhysicUser();
@邻接(label=“usersEdge”,direction=direction.BOTH)
无效设置物理用户(物理用户物理用户);
@邻接(label=“userUvi”,direction=direction.BOTH)
public Iterable getUvis();
@邻接(label=“userUvi”,direction=direction.BOTH)
公共空间设置(Uvis-Uvis);
@财产(“uvi”)
公共字符串getCurrentUvi();
@财产(“uvi”)
公共无效设置当前uvi(字符串uvi);
}
当我在数据库中签入已保存的内容时,我的所有顶点都存储在OrientDB的V类中
有人能帮我吗
先谢谢你
很遗憾,Stefano没有将Java类绑定到OrientDB类,因为TinkerPop Blueprints 2.x中没有这个概念 因此,OrientDB使用id读取类类型,因为它是传播到底层图形实现的唯一参数。试着做:
SocialUser social = getGraph().addVertex("class:SocialUser,"+UUID.randomUUID(), SocialUser.class);
很好,谢谢你!你认为我设置顶点类型的错误解决方案是什么?我认为它更容易阅读和理解。再次感谢你!
SocialUser social = getGraph().addVertex("class:SocialUser,"+UUID.randomUUID(), SocialUser.class);