title: Hibernate: HQL delete from embedded map
body: <p>I want to delete entries from an embedded map. If the object <code>CategoryTag</code> is deleted, I want to execute a HQL query in an interceptor, which deletes the entries from a map:</p>
  
  <p><strong>'Product' model:</strong></p>
  
  <pre><code>@NotNull
  @ElementCollection
  @CollectionTable(name = "producttag", joinColumns=@JoinColumn(name="id"))
  protected Map&lt;CategoryTag, String&gt; tags = new HashMap&lt;CategoryTag, String&gt;();
  </code></pre>
  
  <p>I am kinda blank how i can write the HQL query. It starts with the problem, that I do not know how to reference the map in a delete query. <code>delete Product.tags t where t.key = :tag</code> fails with an <code>Product.tags is not mapped</code> exception.</p>
  
  <p>Can somebody help me on this?</p>