Trying to evaluate OrientDB1.7.3 with Document API for our Analytics.

Was able to save all the simple properties along with other class type 
properties as simple  ones except the List type. 

//Pojo to be inserted
public class PurchaseRequest implements Serializable {
 private String customerName;

 private Address shippingAddress;
 private List<Item> items;
}


//Simplified  DAO api 
public String save(Object entity, String storeName) {    
     ODocument doc = populateDocument(db, entity, storeName);
     db.begin();
     doc = doc.save(true); 
     db.commit();
}


//Util method
 private ODocument populateDocument(ODatabaseDocument oDatabaseDocument, 
 Object entity, String storeName, List<String> excludeKeys) 
 throws Exception {
     ODocument doc = new ODocument(storeName);
     BeanInfo beanInfo = Introspector.getBeanInfo(entity.getClass());
     for (PropertyDescriptor pd : beanInfo.getPropertyDescriptors()) {
       String name = pd.getName();
       if (pd.getReadMethod() != null && !"class".equals(pd.getName())) {
            Method readMethod = pd.getReadMethod();
            Object value = pd.getReadMethod().invoke(entity);
            System.out.println("\n name :" + name + " value:"+ value );
            doc.field(name, value );
       }
     }
     return doc;
 }



Throws an error while saving items as an embedded list.
Appreciated your help.

Cannot serialize the object since it's not implements the 
OSerializableStream interface
at 
com.orientechnologies.orient.core.serialization.serializer.string.OStringSerializerEmbedded.toStream(OStringSerializerEmbedded.java:86)
at 
com.orientechnologies.orient.core.serialization.serializer.record.string.ORecordSerializerStringAbstract.fieldTypeToString(ORecordSerializerStringAbstract.java:218)
at 
com.orientechnologies.orient.core.serialization.serializer.record.string.ORecordSerializerCSVAbstract.embeddedCollectionToStream(ORecordSerializerCSVAbstract.java:823)
at 
com.orientechnologies.orient.core.serialization.serializer.record.string.ORecordSerializerCSVAbstract.fieldToStream(ORecordSerializerCSVAbstract.java:520)
at 
com.orientechnologies.orient.core.serialization.serializer.record.string.ORecordSerializerSchemaAware2CSV.toString(ORecordSerializerSchemaAware2CSV.java:495)
at 
com.orientechnologies.orient.core.serialization.serializer.record.string.ORecordSerializerStringAbstract.toStream(ORecordSerializerStringAbstract.java:669)
at 
com.orientechnologies.orient.core.serialization.serializer.record.string.ORecordSerializerSchemaAware2CSV.toStream(ORecordSerializerSchemaAware2CSV.java:258)
at 
com.orientechnologies.orient.core.record.ORecordSchemaAwareAbstract.toStream(ORecordSchemaAwareAbstract.java:420)
at 
com.orientechnologies.orient.core.record.ORecordSchemaAwareAbstract.toStream(ORecordSchemaAwareAbstract.java:415)
at 
com.orientechnologies.orient.core.record.impl.ODocument.toStream(ODocument.java:446)
at 
com.orientechnologies.orient.client.remote.OStorageRemote.commitEntry(OStorageRemote.java:1931)

Thanks

-- 

--- 
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.

Reply via email to