'Hibernate Envers history table has RevisionType = null when persisting `@Inheritance(strategy = InheritanceType.JOINED)` entities

I'm using @Inheritance(strategy = InheritanceType.JOINED) entities with @Audited annotation on both Parent and Child entity. However after persisting entity, the child history table has revision_type column equals to null instead of the enumeration 0-Add, 1-Mod or 2-Del.

Here it's the mapping used:

@Audited
@Inheritance(strategy = InheritanceType.JOINED)
@Entity
@Table(name = "institution")
public class Institution implements Serializable {
    @Id
    private Long institutionId;
    
    ...

}

@Audited
@Entity
@Table(name = "institution_trust")
public class Trust extends Institution implements Serializable {
    ...
}

Persisting entity:

Trust t = Trust.builder()
                .institutionId(7770001L)
                ... 
                .build();
trustRepository.save(t);

And from hibernate verbose ddl outputs I can see the the _history SQL commands generated only handles revision_type on the parent entity/table.

Hibernate: insert into public.institution (assigned_ops_id, business_email, business_phone_number, country_of_registration, created_at, date_of_registration, institution_type, kyb_status, language, legal_name, other_name, registration_id, related_party, status, tier, updated_at, institution_id) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
Hibernate: insert into public.institution_trust (generic_description_1, trust_type, institution_id) values (?, ?, ?)
Hibernate: select nextval ('public.hibernate_sequence')
Hibernate: insert into public.revision_info (timestamp, id) values (?, ?)
Hibernate: insert into public.institution_history (revision_type, assigned_ops_id, business_email, business_phone_number, country_of_registration, created_at, date_of_registration, institution_type, kyb_status, language, legal_name, other_name, registration_id, related_party, status, tier, updated_at, institution_id, revision_id) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
Hibernate: insert into public.institution_trust_history (generic_description_1, trust_type, institution_id, revision_id) values (?, ?, ?, ?)

Is that be a bug on hibernate-envers? Or Am I missing something on mapping/configurations?

Appreciate any help.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source