Problematic situation is when we have two entities in one to many relation (Task and Note in this case). The "parent" of the relation has to be annotated with cascade PERSIST and the returned type has to be a map. When the element of that map is retrieved and passed to the entity manager remove method, the removal does not take place.
Please see attached files. They should explain everything. If you have any question send it to: arkadiusz.firus@gmail.com