Good morning,
I'm trying to use orientDB graph in transactional mode and i don't know why, but all my Verteces are not saved with type of a proxy class I set at the moment of the creation.
Here is my code :
FramedGraphFactory framedFactory = new FramedGraphFactory();
OrientGraph instance = graphFactory.getTx();
FramedTransactionalGraph<OrientGraph> framedGraph=framedFactory.create(instance);
(GraphFactory is injected via Spring)
SocialUser social = getGraph().addVertex(UUID.randomUUID(), SocialUser.class);
social.setSocialId(lr.getSocialId() + "_" + lr.getSocial());
social.setCreationDate(new Date());
social.setLastLopginDate(new Date());
social.setUserInfo(lr.getInfo());
OrientVertex socialV = (OrientVertex) social.asVertex();
socialV.save();
getGraph().commit();
(getGraph is a method in my class that return the FramedTransactionalGraph).
SocialUser interface
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);
}
When i check in the db what has been saved, all my vertices are stored in the V class of OrientDB.
Someone can help me please?
Thank you in advance
Regards,Stefano
Unfortunately Frames doesn't bind the Java Class to the OrientDB class, because this concept is not present in TinkerPop Blueprints 2.x.
For this reason OrientDB uses the id to read the class type, because it's the only parameter propagated to the underlying Graph implementation. Try doing:
SocialUser social = getGraph().addVertex("class:SocialUser,"+UUID.randomUUID(), SocialUser.class);