【问题标题】:spring jpa onetomany join table auditingspring jpa onetomany 连接表审计
【发布时间】:2017-03-07 11:39:21
【问题描述】:

我的模型中有 oneToMany 和 ManyToOne 映射:

类学院

@OneToMany(fetch = FetchType.EAGER)
@JoinTable(name = "collegecource", joinColumns = @JoinColumn(name = "college", referencedColumnName = "college"), inverseJoinColumns = @JoinColumn(name = "cource", referencedColumnName = "cource"))
private Set<course> course;

在一个能够关联的表中,我有一个额外的列 isActive

我想用 create/update/delete 审计所有表。

我在大学课程中添加了@Audited

@Audited
public class collegecource 

当我尝试使用关系数据创建/更新父级时,审核工作正常。 但是当我尝试删除关系数据(子数据)时,它不是在审核。

你能帮帮我吗。

【问题讨论】:

  • 你有@Audited in Cource 吗?
  • 所以您的问题是当您从college 中删除collegecource 时,collegecourcecollege 都不会发生审计操作?我假设college 也被注释为@Audited?

标签: java spring hibernate jpa hibernate-envers


【解决方案1】:

如果您想要审计字段,请使用 @Audited 注释您的字段。

(子数据)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-08-22
    • 2011-01-28
    • 1970-01-01
    • 1970-01-01
    • 2022-09-28
    • 2016-06-02
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多