[DATACMNS-1404] AuditorAware#getCurrentAuditor called for Entities only marked CreatedAt Created: 12/Oct/18  Updated: 12/Oct/18

Status: Open
Project: Spring Data Commons
Component/s: Core
Affects Version/s: 2.0.10 (Kay SR10)
Fix Version/s: None

Type: Improvement Priority: Minor
Reporter: Yuki Yoshida Assignee: Oliver Drotbohm
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

spring-data-commons 2.0.10

Reference URL: https://github.com/sis-yoshiday/spring-data-auditing-issue
Last updater: Yuki Yoshida


When we have below two entities.


public class EntityWithCreatedBy { 
  @Id @GeneratedValue private Integer id;

  @ManyToOne(fetch = FetchType.LAZY)
  private User createdBy;


public class EntityWithOnlyCreatedAt {

  private Integer id;

  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.


Generated at Sat Jan 25 17:50:55 UTC 2020 using Jira 7.13.8#713008-sha1:1606a5c1e7006e1ab135aac81f7a9566b2dbc3a6.