| By default, a property/field annotated with @Column is insertable and updatable. But when that same field is also annotated with @Generated, the default behavior of the @Column annotation is augmented. In your particular case, the combination of annotations marked the field/property as insertable=false and updatable=false. If you have Envers logging the XML binding data, you'd see it was bound something like the following:
<property insert="false" update="false" name="caseNumber" type="integer">
<column name="caseNumber" length="255" scale="2" precision="19" sql-type="integer auto_increment"/>
</property>
The fix simply needs to determine if a generated value strategy is being used and if so, make sure the field is not flagged as insertable = false on the Envers side of the mapping. |