Hello,

 

I'm trying to store Java objects in OrientDB's Object database, but the 
objects stored all show "null" and "0" values when I browse the database 
for objects of that type.

 

I'm using OrientDB community 2.0-M2 in embedded mode (plocal). 

 

Here is my code, following the instructions/examples here (
https://github.com/orientechnologies/orientdb/wiki/Object-Database):

 

public static void bufferSensorData(CodexDataObject codexData) {

System.out.println("OrientDB, I got your CodexDataObject: \n" + 
codexData.toString());    

 

OObjectDatabaseTx db = new OObjectDatabaseTx(

orientDBStorageMode+":"+

orientDBDatabasePath+

orientDBDatabaseName

).open(orientDBDatabaseUsername, orientDBDatabasePassword);

db.getEntityManager().registerEntityClass(CodexDataObject.class);

        

CodexDataObject codexDataObj = db.newInstance(CodexDataObject.class);

codexDataObj.setStudentID(codexData.getStudentID());

codexDataObj.setFilePath(codexData.getFilePath());

codexDataObj.setTimestamp(codexData.getTimestamp());

codexDataObj.setSequenceNumber(codexData.getSequenceNumber());

codexDataObj.setTrigger(codexData.getTrigger());

codexDataObj.setCode(codexData.getCode());

        

System.out.println("bufferSensorData - OrientDB");

 

db.save(codexDataObj);

 

System.out.println("Saved object \"codexData\" to the OrientDB database.");

        

for(Object o : db.browseClass(CodexDataObject.class)) {

System.out.println("***********************");

System.out.println("Student ID: " + ((CodexDataObject) o).getStudentID());

System.out.println("File Path: " + ((CodexDataObject) o).getFilePath());

System.out.println("Timestamp: " + ((CodexDataObject) o).getTimestamp());

System.out.println("Sequence Number: " + ((CodexDataObject) 
o).getSequenceNumber());

System.out.println("Trigger: " + ((CodexDataObject) o).getTrigger());

System.out.println("Code: " + ((CodexDataObject) o).getCode());

System.out.println("**********************");

}

}

 

Any help would be appreciated. I was thinking of switching to the document 
database, but I still wanted to understand why it seemed not to work for me.

 

Regards,

Jeremie
 

-- 

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