-
1. Re: Audit Table Primary Key Issues
adamw Mar 29, 2013 9:19 AM (in response to mcauleyj)Hmm, well the audit table's key should be copied from the entity's key. Are the properties in any way part of the primary key of the entity?
Adam
-
2. Re: Audit Table Primary Key Issues
mcauleyj Mar 29, 2013 12:07 PM (in response to adamw)Hi Adam,
Thanks for your prompt response. The properties shouldn't be included in the primary key for the entity. I checked this by forcing recreation of the main data table (for the same data type I used previously as an example) and here's the logging output:
create table TICKET (ID integer not null, FIELD1 varchar(255), FIELD2 varchar(255), FIELD3 varchar(255), FIELD4 longtext, FIELD5 integer, FIELD6 varchar(255), ..., primary key (ID)) ENGINE=InnoDB
I thought that the audit table utilized the primary key from the table being audited and tacked on REV so I was also surprised to see another column get pulled in for properties. For the record, here's a snippet from our hbm.xml for mapping properties:
<map name='properties' table='TICKET_PROPERTIES' cascade='all'>
<key column='TICKET_ID'/>
<map-key column='PROPERTY_KEY' type='java.lang.String'/>
<element column='PROPERTY_VALUE' type='java.lang.String'/>
</map>
For the record we are using Hibernate and Envers 4.1.6. Any input is appreciated, thanks!
-
3. Re: Audit Table Primary Key Issues
adamw Apr 2, 2013 4:13 PM (in response to mcauleyj)Can you maybe post a full (but minimal ) example of an entity with its primary key, which causes problems?
I have no idea why this could be happening.
Adam