I want to delete entries from an embedded map. If the object CategoryTag
is deleted, I want to execute a HQL query in an interceptor, which deletes the entries from a map:
'Product' model:
@NotNull
@ElementCollection
@CollectionTable(name = "producttag", joinColumns=@JoinColumn(name="id"))
protected Map<CategoryTag, String> tags = new HashMap<CategoryTag, String>();
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. delete Product.tags t where t.key = :tag
fails with an Product.tags is not mapped
exception.
Can somebody help me on this?