title: Hibernate Criteria for Map key-value
body: <p>I have the following property in my hibernate entity:</p>
  
  <pre><code>@ElementCollection(targetClass = String.class, fetch = FetchType.EAGER)
  @CollectionTable(name="FORMDATA", joinColumns = @JoinColumn(name="FORM_ID"))
  private Map&lt;String, String&gt; formData;
  </code></pre>
  
  <p>I want to do a query with hibernate Criteria where I want to match a form with a given key-value pair, something like this:</p>
  
  <pre><code>criteria.add(Restrictions.like("formdata.key", "%"+value+"%").ignoreCase());
  </code></pre>
  
  <p>where 'key' and 'value' are passed via method parameters.</p>
  
  <p>Anyone knows how this should work? For me the hibernate documentation is not clear on this.</p>
  
  <p>Thanks a lot,
  B.</p>