I have a hashmap:
Map<String, String> map = new HashMap<String, String>
I would like to map keys and values of hashmap to table's column. For example, if I have something like this: (key1, value1); (key2, value2), the table will look like:
id key value
1 key1 value1
2 key2 value2.
I've tried use something like this in my model class
@ElementCollection
@MapKeyColumn(name = "property")
@Column(name = "value", nullable = false)
private Map<String, String> settings = new HashMap<String, String>();
but it couses that hibernate creates two tables: first one with one column: id, second one with three columns id_table (foreign key to id from first column), key, value.
I will be grateful for any help.