Announcement Announcement Module
No announcement yet.
Soft Delete Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Soft Delete

    Not sure if this is a Roo or a JPA question...

    I have some data that I need to keep an auditLog for that holds the information on actions performed on the data. This audit data should exist even if the actual data was deleted, so obviously I need a soft delete, e.g. active flag.

    To do this with my roo based app I had to push in the _roo_entity and _roo_finder ITD's into my class and modify the remove() method so it set the flag as inactive and then all my finders so they had " and active=1" as part of the finder. I guess I could still use the roo finder mechanism but would have to do all my new finders with "AndActiveEquals".

    It would be nice if we could tell roo to make an entity soft delete and let roo manage the active flag the same way it does the id and version flags. That way you could swap between actual delete and soft delete versions without changing your code or your finders.

    I have added a JIRA enhancement request.

  • #2

    Thanks for the suggestion and the Jira ticket. We will take a closer look if this is something that makes sense to be included in the core artifacts or rather as a add-on functionality.



    • #3
      Have you considered the option of adding a @PostRemove method that would save a history entry (another entity) of the target entity once it is deleted?