@SuppressWarnings("unchecked")
 public <T> T retrieve(String dbID, String key, Class<T> type) {
   PersistentEntry entry = retrieveEntry(dbID, key);
   if (entry != null) {
     return (T) entry.getData();
   }
   return null;
 }
  public <T> void persist(String dbID, String key, T data) {
    // Update entry if entry has already existed
    // otherwise create a new entry
    PersistentEntry entry = retrieveEntry(dbID, key);
    if (entry == null) {
      entry = new PersistentEntry(key);
    }
    entry.setData(data);
    // Store to object database
    getObjectContainer(dbID).store(entry);
    getObjectContainer(dbID).commit();

    // Get
    Query query = getObjectContainer(dbID).query();
    query.constrain(PersistentEntry.class);
    query.descend("key").constrain(key);
    ObjectSet<PersistentEntry> result = query.execute();
    if (result.size() > 0) {
      System.out.println(result.get(0));
    }
  }