I want to use SpringData annotations from package org.springframework.data.annotation
@CreatiedOn
@CreatedBy
@ModifiedOn
@ModifiedBy
My configuration is as well:
@Embeddable
public class AuditFields {
@Column({...})
@CreatedBy
private String createdBy;
@Column({...})
@CreatedDate
private Instant createdOn;
@Column({...})
@LastModifiedBy
private String updatedBy;
@Column({...})
@LastModifiedDate
private Instant updatedOn;
... And the AuditFileds
is applied as composition:
@Entity
public class A {
{...}
@ElementCollection
@CollectionTable({...})
private Collection<B> b;
@Embedded
private AuditFields auditFields = new AuditFields();
}
and
@Embeddable
public class B {
{...}
@Embedded
private AuditFields auditFields = new AuditFields();
}
... and I also have configured @EnableJpaAuditing
bean
The framework works perfect when persists class A
and the @Entity
object has been successfully audited, but nothing happens on class B
which is @Embeddable
collection (record B is not audited into the table).
Any ideas why SpringData audit neglect @Embeddable
collection? Is it problem in SpringData?
Any ideas for another aproach how to audit @Embeddable
collection?
spring-data-jpa
is version 2.7.15
.