StevenTomer
unread,Mar 1, 2012, 3:40:22 PM3/1/12Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Sign in to report message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to OrientDB
The following test case causes the problem:
public void TransactionNullsInUniqueIndexTest()
{
System.out.println("**************************
TransactionNullsInUniqueIndexTest
***************************************");
ODatabaseDocumentTx db = new ODatabaseDocumentTx(url);
db.open("admin", "admin");
OClass vertexClass =
db.getMetadata().getSchema().createClass("TRNVertex");
OClass edgeClass =
db.getMetadata().getSchema().createClass("TRNEdge");
vertexClass.createProperty("in", OType.LINKSET, edgeClass);
vertexClass.createProperty("out", OType.LINKSET, edgeClass);
edgeClass.createProperty("in", OType.LINK, vertexClass);
edgeClass.createProperty("out", OType.LINK, vertexClass);
OClass personClass =
db.getMetadata().getSchema().createClass("TRNPerson", vertexClass);
personClass.createProperty("ssn",
OType.STRING).createIndex(OClass.INDEX_TYPE.UNIQUE);
personClass.createProperty("name",
OType.STRING).createIndex(OClass.INDEX_TYPE.NOTUNIQUE);
db.getMetadata().getSchema().save();
db.begin();
ODocument john = new ODocument("TRNPerson");
john.field("name", "John Doe");
john.field("ssn", "123-45-6789");
john.field("in", new HashSet<ODocument>());
john.field("out", new HashSet<ODocument>());
ODocument james = new ODocument("TRNPerson");
james.field("name", "james Doe");
james.field("ssn", "987-65-4321");
james.field("in", new HashSet<ODocument>());
james.field("out", new HashSet<ODocument>());
ODocument jane = new ODocument("TRNPerson");
jane.field("name", "jane Doe");
jane.field("in", new HashSet<ODocument>());
jane.field("out", new HashSet<ODocument>());
ODocument edge1 = new ODocument("TRNEdge");
edge1.field("in", john.getIdentity());
edge1.field("out", james.getIdentity());
((HashSet<ODocument>)john.field("out")).add(edge1);
((HashSet<ODocument>)james.field("in")).add(edge1);
edge1.save();
ODocument edge2 = new ODocument("TRNEdge");
edge2.field("in", james.getIdentity());
edge2.field("out", jane.getIdentity());
((HashSet<ODocument>)james.field("out")).add(edge2);
((HashSet<ODocument>)jane.field("in")).add(edge2);
edge2.save();
john.save();
james.save();
jane.save();
db.commit();
db.close();
System.out.println("**************************
TransactionNullsInUniqueIndexTest
***************************************");
}