【问题标题】:Automatically Ignore @OneToMany, @ManyToOne自动忽略@OneToMany、@ManyToOne
【发布时间】:2018-12-11 13:31:24
【问题描述】:

我正在使用 Javers 成功记录实体,但是对于每个实体,我必须使用 @DiffIgnore 和 @ShallowReference 来忽略使用 @OneToMany、@ManyToOne 等映射的字段。 我正在尝试在 JaversBuilder 上进行配置,但没有成功。 有没有办法在 Javers 上配置以自动忽略使用这些注释映射的属性?还是只取带有@Column 注解的属性?

我阅读了这些,并尝试遵循一些答案,但它也没有奏效。

Javers - DiffIgnore on bidirectional OneToMany

Javers default ignore instead of default include

【问题讨论】:

    标签: javers


    【解决方案1】:

    没有办法命令 JaVers 忽略具有特定注释的字段。 JaVers 不会读取您的类中的所有注释。

    您可以在自己这边实现一个注释扫描器,然后在 JaversBuilder 中注册您的 EntityDefinitions:

    public JaversBuilder registerEntity(EntityDefinition entityDefinition)

    【讨论】:

    • 谢谢,但据我所知,我必须为每个实体都这样做,而且我已经在使用 DiffIgnore 和 ShallowReference 注释。优点是我可以使用此实体定义自动执行一些代码。但无论如何,谢谢你的回答。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-11-14
    • 1970-01-01
    • 1970-01-01
    • 2016-02-28
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多