We're updating the issue view to help you get more done. 

Field marked as @Generated not being audited.

Description

I have a table, which has an auto_increment field (this is not the PK, it is just another field), which I defined this way:

@NotNull
@Generated(GenerationTime.INSERT)
@Column(columnDefinition = "integer auto_increment")
private int caseNumber;

I also created an index and a unique constraint for this field as mysql requires.

Somehow Envers is not recognizing this field and doesn't store the value of caseNumber in the audition table. The insert sentence that is being logged saves all fields of my entity but this one.

Does anyone know why this is happening? Is something wrong in the definition of the field? Is Envers not getting along with auto_increment?

I guess that as the caseNumber is not "inserted" but autogenerated, Envers doesn't notice that this field has a value. If this is the case it is actually a bug because is an actual value that should be tracked. Is there any workaround?

Environment

Hibernate 5.1.0.Final, Wildfly 10, mariaDB (mysqldriver 1.3.7)

Status

Assignee

Chris Cranford

Reporter

Imanol Bernabeu Aramendi

Fix versions

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

5.1.0

Priority

Major