Open
Description
Yuki Yoshida opened DATACMNS-1404 and commented
When we have below two entities.
@Entity
@EntityListeners(AuditingEntityListener.class)
public class EntityWithCreatedBy {
@Id @GeneratedValue private Integer id;
@ManyToOne(fetch = FetchType.LAZY)
@CreatedBy
private User createdBy;
}
@Entity
@EntityListeners(AuditingEntityListener.class)
public class EntityWithOnlyCreatedAt {
@Id
@GeneratedValue
private Integer id;
@CreatedDate
private LocalDateTime createdDate;
}
And try to save them, then org.springframework.data.domain.AuditorAware#getCurrentAuditor
was called for both of them.
It would be nice when we save entity that does not have @CreatedBy
or @LastModifiedBy
,
AuditorAware#getCurrentAuditor
stop being called.
I attached reproduction project (by spring-data-jpa) to Reference URL.
Affects: 2.0.10 (Kay SR10)
Reference URL: https://github.com/sis-yoshiday/spring-data-auditing-issue