3 Replies Latest reply on Apr 24, 2013 10:43 AM by adamw

    Hibernate Envers with partitioned database

    timdua

      We are using a MySQL partitioned db (same schema for each db) and need to audit data by company. (so we have extra company id key in every entity)

      Some companies have their data on a certain server, others on another.

      So i guess that to accomplish auditing we need a composite revision id: [companyId, revId] in the "revinfo" table and also in the audit tables themselves.

      We want to know entity changes for each company.

      We also must be able to copy all data of one company to another server including the audit data.

      "CompanyId" is unique over all servers.

      For now this seems impossible.

       

      Is this possible with the current version of envers?

        • 1. Re: Hibernate Envers with partitioned database
          adamw

          Well, the audit entity's id is composed of the revision number + primary key for the audited entity. So if the entity contains the company id in its primary key, it should work.

           

          Adam

          • 2. Re: Hibernate Envers with partitioned database
            timdua

            Thanks for answering my question but the way we would like it to function is the following:

            The revision number should increase per company like that:

            companyId    revision number

            10000008      1

            10000008      2

            10000009      1

            10000009      2

            10000009      3

             

            That way we could easily copy company data (also the company audit data itself) from one server to another without having conflicting keys.

            • 3. Re: Hibernate Envers with partitioned database
              adamw

              Maybe this would be possible with a custom revision entity and a custom id generation strategy?

               

              Adam