I am storing hashtable in mongodb using BasicDBObject. And now I want to retrieve this hashtable.How can I do this?
HashTable<String, Login> loginHashTable;
HashTable<String, Other> otherHashTable;
DBCollection coll = db.getCollection(users);
BasicDBObject obj = new BasicDBObject();
obj.insert("HashTable1", loginHashTable);
obj.insert("HashTable2", otherHashTable);
coll.insert(obj);
It is stored properly without errors but how can I retrieve a particulat hashTable. Suppose I want to retrieve loginHashTable. So, how can I do this?
Somewhat like this:
HashTable <String,Login> retrieveTable = obj.get("HashTable1");
My login class is like this:
public class Login extends ReflectionDBObject implements Serializable
{
/** Enterprise user name used for authentication. */
public String username = null;
/** Enterprise password used for authentication. */
public String password = null;
/**Name of manufacturer of mobile phone*/
public String manufacturer = null;
/**Name of model of mobile phone*/
public String model = null;
/**Language in which Mobile software release is needed*/
public String language = null;
/**Current version of the software*/
public String version = null;
public static String id;
}
My other class is like this:
public class Other extends ReflectionDBObject implements Serializable
{
public String sessionID = null;
}