title: Mapping HashMap as table's columns using hibernate annotation
body: <p>I have a hashmap:</p>
  
  <pre><code>Map&lt;String, String&gt; map = new HashMap&lt;String, String&gt;
  </code></pre>
  
  <p>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:</p>
  
  <pre><code>id  key  value
  1   key1 value1
  2   key2 value2.
  </code></pre>
  
  <p>I've tried use something like this in my model class</p>
  
  <pre><code>@ElementCollection
  @MapKeyColumn(name = "property")
  @Column(name = "value", nullable = false)
  private Map&lt;String, String&gt; settings = new HashMap&lt;String, String&gt;();
  </code></pre>
  
  <p>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.</p>
  
  <p>I will be grateful for any help.</p>