1 Reply Latest reply on Dec 7, 2009 7:46 AM by adamw

    Collisions with manually assigned keys?

    nickarls

      Hi,

      I'm currently evaluating Envers and it looks promising!

      A question, though, that I didn't find in the manual: if you have manually assigned ID:s and delete an audited entity and another one with the same ID appears, what to do? Manually archive the old audit log? Any other best practices? Because otherwise the audit logs between the old and new instance will become mixed, yes?

        • 1. Re: Collisions with manually assigned keys?
          adamw

          Yes, this will indeed be a problem. I think that generally having globally unique ids is better, especially if you want auditing, but if you can't have that, then I guess you'll have somehow to "archive" the old entries.

          One possibility is of course to simply remove the history. You can issue a bulk sql operation: delete from MyEntity_AUD e where e.originalId.id = :newId. But then there's a problem of also deleting all the related entities etc.

          Adam