Hibernate Envers历史记录表具有RevisionType = null时,持续`@inheritance(stragity = sashitanceType.joined)`实体

发布于 2025-01-26 03:39:13 字数 2061 浏览 4 评论 0原文

我正在使用@inheritance(stragity = sashitanceType.joined)带有@Audited penter 的实体对父母和子女实体的注释。但是,在坚持实体之后,子历史表具有revision_type列等于null而不是枚举0-ADD,1-mod或2-del。

这是使用的映射:

@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 {
    ...
}

持久的实体:

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

从冬眠的详细ddl输出中,我可以看到_历史sql命令仅生成handles revision_type

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 (?, ?, ?, ?)

这是Hibernate-Envers上的错误吗?还是我错过了映射/配置上的东西?

感谢任何帮助。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文