'Abstract entity audited

I have an abstractEntity model like below:

@MappedSuperclass
@EntityListeners(AuditingEntityListener.class)
@Datapublic class AbstractEntity implements Serializable {
private static final long serialVersionUID = 1L;

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id", updatable = false, insertable = false, nullable = false)
protected Long id;

@Column(nullable = false, columnDefinition = "int default 1")
protected Integer isEnabled = 1;
}

i have subclasses that inherit from this class. i want to make for example the attribute isEnabled @audited, but only for some subclasses.

Example A, B, C are subclasses of AbstractEntity, i want to make the audit on isEnabled only for class A?



Sources

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

Source: Stack Overflow

Solution Source