Hi, If have issue could you create it in bug tracker ?
On Fri, May 16, 2014 at 10:32 PM, Odysseas <[email protected]> wrote: > Here is a test case below that reproduces the problem. > > Before the index is created, the list of classes is: > Class: ORestricted > Class: personTest > Class: ORIDs > Class: OSchedule > Class: OTriggered > Class: ORole > Class: E > Class: OUser > Class: OFunction > Class: OIdentity > Class: V > > and right after that when we create the index the exception is: > > com.orientechnologies.orient.core.exception.OCommandExecutionException: > Class PERSONTEST not found > at > com.orientechnologies.orient.core.sql.OCommandExecutorSQLCreateIndex.parse(OCommandExecutorSQLCreateIndex.java:101) > at > com.orientechnologies.orient.core.sql.OCommandExecutorSQLCreateIndex.parse(OCommandExecutorSQLCreateIndex.java:47) > at > com.orientechnologies.orient.core.sql.OCommandExecutorSQLDelegate.parse(OCommandExecutorSQLDelegate.java:52) > at > com.orientechnologies.orient.core.sql.OCommandExecutorSQLDelegate.parse(OCommandExecutorSQLDelegate.java:33) > at > com.orientechnologies.orient.core.storage.OStorageEmbedded.command(OStorageEmbedded.java:83) > at > com.orientechnologies.orient.core.command.OCommandRequestTextAbstract.execute(OCommandRequestTextAbstract.java:59) > at > com.orientechnologies.orient.server.network.protocol.binary.ONetworkProtocolBinary.command(ONetworkProtocolBinary.java:1100) > at > com.orientechnologies.orient.server.network.protocol.binary.ONetworkProtocolBinary.executeRequest(ONetworkProtocolBinary.java:350) > at > com.orientechnologies.orient.server.network.protocol.binary.OBinaryNetworkProtocolAbstract.execute(OBinaryNetworkProtocolAbstract.java:160) > at com.orientechnologies.common.thread.OSoftThread.run(OSoftThread.java:45) > > public class TestOrientDbCreateClassAndIndex extends TestCase > { > private final static String DB_URL = "remote://localhost/person-db"; > private Logger log = Logger.getLogger(getClass()); > > public void testCreateClassAndIndex() { > OrientGraphNoTx db = new OrientGraphNoTx(DB_URL); > > int[] clusterIds = null; > String className = "personTest"; > OClass vertexClass = findGraphClass(db, "V"); > final OClassImpl sourceClass = (OClassImpl) ((OSchemaProxy) > db.getRawGraph().getMetadata().getSchema()) > .createClassInternal(className, vertexClass, clusterIds); > log.info("Class " + className + " has been assigned cluster " + > sourceClass.getDefaultClusterId()); > sourceClass.saveInternal(); > > String[] attributes = { "givenName", "familyName", "middleName" }; > for (String fieldName : attributes) { > OType type = OType.STRING; > OPropertyImpl prop = (OPropertyImpl) > sourceClass.getProperty(fieldName); > if (prop != null) { > log.warn("Property '" + className + "." + fieldName + "' > already exists."); > continue; > } > prop = sourceClass.addPropertyInternal(fieldName, type, null, > null); > log.debug("Adding field " + fieldName + " to class " + > className); > sourceClass.saveInternal(); > } > > db.getRawGraph().getStorage().reload(); > db.getRawGraph().getMetadata().getSchema().reload(); > db.getRawGraph().getMetadata().getIndexManager().reload(); > > Collection<OClass> classes = > db.getRawGraph().getMetadata().getSchema().getClasses(); > StringBuffer sb = new StringBuffer(); > for (OClass clazz : classes) { > sb.append("Class: " + clazz.getName() + "\n"); > } > System.out.println("Before creating the indexes the list of > classes is: " + sb.toString()); > > String sql = "CREATE INDEX idx-person-familyName ON personTest > (familyName) NOTUNIQUE"; > log.debug("Creating index: " + sql); > db.command(new OCommandSQL(sql.toString())).execute(new Object[] > {}); > } > > private OClass findGraphClass(OrientBaseGraph db, String className) { > Collection<OClass> classes = > db.getRawGraph().getMetadata().getSchema().getClasses(); > log.debug("The repository currently has " + classes.size() + " > classes defined:"); > for (OClass oclass : classes) { > if (oclass.getName().equalsIgnoreCase(className)) { > return oclass; > } > } > return null; > } > > -- > > --- > You received this message because you are subscribed to the Google Groups > "OrientDB" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- Best regards, Andrey Lomakin. Orient Technologies the Company behind OrientDB -- --- You received this message because you are subscribed to the Google Groups "OrientDB" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
