Hi,


I have the following entities to be persisted via object database.


<https://lh3.googleusercontent.com/-sSaAi3PmF7w/UxRf70w_iAI/AAAAAAAAAEo/HF-RBMHTso0/s1600/uml.tiff>


when i call


OObjectDatabaseTx.setAutomaticSchemaGeneration(true);

odb.getEntityManager().registerEntityClasses(classNames);

orient throws the following exception


com.orientechnologies.orient.core.exception.OSchemaException: Class 
Component already has property 'inputs'


After some source code inspection I found the problem probably is at the 
lines 552-555 of the OObjectEntitySerializer class:


if (automaticSchemaGeneration && 

    !currentClass.equals(Object.class) && 

    !currentClass.equals(ODocument.class)) {

   

   ((OSchemaProxyObject)ODatabaseRecordThreadLocal.INSTANCE.get()

   .getDatabaseOwner().getMetadata().getSchema())

   .generateSchema(currentClass, ODatabaseRecordThreadLocal.INSTANCE.get());

}

where the serializer does not check for already serialized classes during 
transitive serialization.
I applied this workaround to the source code:

if (automaticSchemaGeneration && 

    !currentClass.equals(Object.class) && 

    !currentClass.equals(ODocument.class) &&

    
!ODatabaseRecordThreadLocal.INSTANCE.get().getDatabaseOwner().getMetadata()

      .getSchema().existsClass(currentClass.getSimpleName())) {

        

   ((OSchemaProxyObject)ODatabaseRecordThreadLocal.INSTANCE.get()

   .getDatabaseOwner().getMetadata().getSchema())

   .generateSchema(currentClass, ODatabaseRecordThreadLocal.INSTANCE.get());

}

now all seems work fine. The source version is the 1.7-rc2-SNAPSHOT but the 
same problem there is in the 2.0-SNAPSHOT too.

Is it a bug or there is some thing I don't do before calling the lines:
OObjectDatabaseTx.setAutomaticSchemaGeneration(true);

odb.getEntityManager().registerEntityClasses(classNames); 
?

Some help will be appreciated.



-- 

--- 
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/groups/opt_out.

Reply via email to