1 Reply Latest reply on Jan 25, 2011 8:38 AM by Adam Warski

    Data migration

    apph_ apph_ Newbie

      Hi,

       

      One more case we have is data migration to the new ValidityAuditStrategy. We have loads of data, but don't have the initial entries in historic tables about record creation. The result of it is problem as described here: http://community.jboss.org/message/577273 . Moreover we have custom @RevisionEntity with additional user-data and some other stuff. Do you guys see any way to migrate this data - basically create entity creation entry in audit table and combined entry in @RevisionEntity table?

       

      Currently we have all the data in import.sql script which is loaded at startup, but unfortunately it bypasses hibernate mechanisms and in consequence envers does not create mentioned earlier entries.

       

      Regards

      Krzysiek

        • 1. Data migration
          Adam Warski Master

          Well it is not even required that you have the initial revision, but that you have the "last" revision. If you are importing data, I think the best solution is to keep everything consistent and for all new inserted rows create a "0" revision. That is:

          1. insert a new row to the revision table, write down the id

          2. insert the rows into the target table

          3. insert corresponding rows into _AUD table using the revision number

           

          I think finding which rows need to be inserted into _AUD tables can be done using SQL as well.

           

          Adam