2 Replies Latest reply on Sep 12, 2011 10:47 AM by Adriano Saturno

    Automatic audit tables generation in xml hibernate mapping

    Adriano Saturno Newbie

      I'm using envers under a project that uses xml hibernate mapping.

       

      I'm creating the audit tables and the revinfo table via script.

       

      Is there any way to automatize this task? What is the most common approach to these cases?

       

      Thanks.

        • 1. Re: Automatic audit tables generation in xml hibernate mapping
          Adam Warski Master

          What kind of script? You can use hbm2ddl or the envers hibernate tool task to generate the mappings.

           

          Adam

          • 2. Re: Automatic audit tables generation in xml hibernate mapping
            Adriano Saturno Newbie

            This kind of script:

             

            CREATE TABLE "A_SMUNIZ"."REVINFO"

              (

                REV     NUMBER(10,0) NOT NULL ENABLE,

                RVTSTMP NUMBER(19,0),

                PRIMARY KEY (REV) USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) TABLESPACE "TSLOCAL" ENABLE

              )

              SEGMENT CREATION IMMEDIATE PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING STORAGE

              (

                INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT

              )

              TABLESPACE "TSLOCAL" ;

             

            It seems much better to use another approach... I will try hbm2ddl and the envers hibernate tool task.

             

            Thanks!