I would like to create a few classes which are in essense wrapper of a map of key value pair. What is the best appoarch to retrieve or store these classes into a database using hiberate? What are the right hibernate annotations to get the job done?
On the database, I would expect this formation of data
class1, field1, value1
class2, field2, value2
class1, field2, somevalue1
...
On the java side, I may have
@Table("some_db_table")
class KeyValuePairs {
private HashMap<String, String> map;
...
}
class Class1 extends KeyValuePairs {
private Stirng id = "class1";
...
}
class Class2 extends KeyValuePairs {
private Stirng id = "class2";
...
}