jmix-framework / jmix

Jmix framework
https://www.jmix.io
Apache License 2.0
692 stars 124 forks source link

Implement design-time audit for entites #321

Open aleksey-stukalov opened 4 years ago

aleksey-stukalov commented 4 years ago

Take https://hibernate.org/orm/envers/ as a canonical way.

@Table(name = "PETCLINIC_OWNER")
@Entity(name = "petclinic_Owner")
@Audited // all fields of the entity will be audited
public class Owner extends Person {
    ...
}

@Entity(name = "petclinic_Pet")
// only some fields will be audited
public class Pet extends NamedEntity {
    private static final long serialVersionUID = -3431453457784831240L;

    @NotNull
    @Column(name = "IDENTIFICATION_NUMBER", nullable = false)
    @Audited
    protected String identificationNumber;

    @Temporal(TemporalType.DATE)
    @Column(name = "BIRTH_DATE")
    @Audited
    protected Date birthDate;

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "TYPE_ID")
    protected PetType type;

    ...
}
aleksey-stukalov commented 4 years ago

Probably it would make sense to externalize configuration for audit, similarly to design time roles and access groups.