5 Replies Latest reply on Oct 1, 2009 11:40 AM by adamw

    joined-subclass audit

    vgor

      Hi Adam,
      I have problem with Envers.
      When i have for example next mapping:

      class name="Contact" table="contact">

      ...
      <joined-subclass name="User" table="user">
      <key column="user_id" not-null="true"/>
      ...
      /class>

      contact pk is contact_id
      user pk is user_id
      And when i add Audit and try to insert or update user generated audit save sql is next:
      insert
      into
      user_AUD
      (..., contact_id, REV)
      values
      (..., ?, ?)

      user_AUD is copy of user and do not has contact_id ....

        • 1. Re: joined-subclass audit
          adamw

          Hello,

          do you get an exception or are the genrated audit tables wrong?

          Adam

          • 2. Re: joined-subclass audit
            vgor

            Hello thanks for reply,
            generated audit tables are not wrong. But i want to create audit tables manually not by setting 'hibernate.hbm2ddl.auto' parameter. And i create audit table as a copy of table with two additional fields and get error.

            • 3. Re: joined-subclass audit
              adamw

              So ... if the tables you created manually are different from the ones generated by Envers, this means the latter are wrong, right?

              Adam

              • 4. Re: joined-subclass audit
                vgor

                But the audit table is a copy of the table in the database with two additional fields. If the class User is mapped in Hibernate as joined-subclass of some class for example Contact and physical table user has primary key user_id why user_AUD genereted by Envers has primary key contact_id?

                • 5. Re: joined-subclass audit
                  adamw

                  Ah - this may be a bug then. Please report it in JIRA if possible, with a testcase.

                  Adam