I'm using db4o to store different objects in an android application. I get json contents from a sever then them into Objects (contacts here) that I store in a db4o file.
ObjectContainer mainDB = Db4oEmbedded.openFile(dbConfig(), DB_MAIN);
mainDB.store(aContact);
Now if I directly make a query to get them back from the DB, it works.
try {
ObjectSet<Contact> result = db.queryByExample(Contact.class);
contacts = new ArrayList<Contact>(result);
} catch (Exception e) {
e.printStackTrace();
}
I can loop on the arraylist and the contacts are there, I can print their names and other fiels. But now if I close de db :
mainDB.close();
If I reopen it with the same code, there's nothing inside anymore, contacts.size() returns 0. What's wrong? Any idea? Thanks in advance...