| Imanol Bernabeu Aramendi, no worries. I made a code change that will be included in the 5.1.1 and 5.2.1 releases that makes the field in the Envers audit table insertable. Without that code change, there isn't a way to make this work unfortunately. It was simply a bug when using @Generated on a column within an audited entity, nothing more. The auto_increment portion of the columnDefinition simply causes the audit table column to be created as an auto_increment column too, which makes no sense from an Envers perspective since the audit table is simply meant to be a data capture table. What I would suggest is after the audit table has been created if you use the HBM2DDL feature of Hibernate, simply manually alter the table and change the column from auto_increment to integer since that is what your definition says in your case, so that it's correct. But understand this won't have any influence on the population of the value. If you urgently need to fix for populating the field, you have 2 options ( short of waiting for 5.1.1 or 5.2.1 to be released ):
- Build the 5.1 or 5.2 (currently master) branches manually and use that rather than the published 5.1.0.Final / 5.2.0.Final builds.
- Checkout the 5.1 / 5.2 tag from Github and manually make the changes I did to AuditMetadataGenerator (github commit), build and use that instead of 5.1.0.Final / 5.2.0.Final.
Hope that helps. |