I am evaluating the use of OrientDb for our platform (2.1 rc5) in embedded
mode. But Ive run into retrieval issues. It seems like I can write but
cannot read any records written. Keeps Complaining about registration of
classes or types.
There must be something obviously wrong in what I have done. But Cant
figure it out . Im attempting to use OrientDB in as an embedded document
database. It seems like can save the Map of name values to the Datastore.
But is not bale to retrieve any records. Every time I access any API that
iterates over the collection, it results in the following error.
"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 JAVA Document API doesn't mention anything about registering classes.
==========================Code Block ====================================
public Map createObject(String clazz, Map<String,String> map) {
OObjectDatabaseTx db = getDatabaseConnection();
db.getEntityManager().registerEntityClasses(clazz);
ODocument document = new ODocument(clazz);
document.fromMap(map);
// this save works. (Using db.countClass(clazz) reflects correct count.
document = document.save();
//--- The Following results in Error ( this is just an e.g.) --/
List<ODocument> result = db.query(
new OSQLSynchQuery<ODocument>("select * from " + clazz) );
//--- The Above results in Error --/
db.close();
return result.get(0).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;
}
==========================Code Block ====================================
--
---
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.