Skip to content

AuditingEntityListener with Embeddable classes #2365

@dgallego58

Description

@dgallego58

i see that an Entity with @CreatedDate and @LastModifiedDate and other auditable annotations works nice when those attributes are in the same class annotated with @entity, but it doesn't seem to work when those are on a @Embeddable annotated class

@Embeddable public class Auditable { @CreatedDate private Instant cratedDate; @LastModifiedDate private Instant lastModifiedDate; ... }
@Entity @EntityListeners(AuditableListener.class) //this works with embedded, it is a custom Auditable //@EntityListeners(AuditingEntityListener.class) //doesn't work for embedded public class EntityB implements AuditableEntity{ @Id @GeneratedValue private UUID uuid; private String randomAtt; @Embedded private AuditablePart auditablePart; ...

it would be cool if it can be used a similar approach by using the same AuditingEntityListener.class in addition to a custom one

i made a demo project showing this

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions