Im using OrientDB in an embedded mode as a Document Database. It seems like
i can save documents into the Db (nv pairs only). But Cannot retrieve
anything. The db.count(className) reflects the correct count, but the
following statement results in an error.
List<ODocument> result = db.query(
new OSQLSynchQuery<ODocument>("select * from " + clazz) );
"com.orientechnologies.orient.core.exception.OSerializationException: Type
<> cannot be serialized because is not part of registered entities. To fix
this error register this class"
The Documentation for document API doesnt mention anything about
registering classes. It was my understanding that OrientDB can handle
Schema-less docuements.
============================== Sample Code
========================================
@Override
public Map createObject(String clazz, Map<String,String> map) {
OObjectDatabaseTx db = getDatabaseConnection();
db.getEntityManager().registerEntityClasses(clazz);
ODocument document = new ODocument(clazz);
document.fromMap(map);
document = document.save();
List<ODocument> result = db.query(
new OSQLSynchQuery<ODocument>("select * from " + clazz) );
System.out.println("DB Record(s)" + result.size());
db.close();
return document.toMap();
}
private static OObjectDatabaseTx getDatabaseConnection(){
OObjectDatabaseTx db = new OObjectDatabaseTx ("plocal:sampledb");
if(!db.exists()) {
db = db.create();
db.close();
}
db.open("admin", "admin");
return db;
}
============================== Sample Code Ends
========================================
--
---
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.