nanlabs / logical-delete

Apache License 2.0
8 stars 8 forks source link

Feature Request: Logically delete parent but physically delete children #6

Open vahidpaz opened 10 years ago

vahidpaz commented 10 years ago

It's currently not possible to annotate a parent entity with @LogicalDelete while its children (hasMany) are without @LogicalDelete. It would be nice to not be forced to mark the entire tree as @LogicalDelete.

Though technically you can physically delete the children by manually issuing delete(physical:true), it would be better to not require any manual intervention. This feature request makes most sense when deletes can cascade (https://github.com/nanlabs/logical-delete/issues/2).

This limitation seems to be happening becuase of DeleteHibernateFilterConfigurator.enrichLogicalDeleteCollections(). Maybe make the enricher smarter so that it considers if the element type of the collection is marked as @LogicalDelete or not. If not, then don't add filtering for that association.