I'm configuring an entity update method, and I'm curious what the result will be if I put the same value in the same column as before and perform dirty checking.
public class Member extends BaseEntity {
@Id
@Column(name = "member_id")
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(unique = true, nullable = false)
private String email;
@Column(nullable = false)
private String password;
@Column(unique = true, nullable = false)
private String username;
@Column(nullable = false)
@Enumerated(EnumType.STRING)
private MBTI mbti;
@Column
private Boolean isDeleted;
@Column
private String statusMessage;
@Column
private String avatar;
public static Member toEntity(MemberRequestDto.signup requestDto) {
return Member.builder()
.email(requestDto.getEmail())
.password(requestDto.getPassword())
.username(requestDto.getUsername())
.mbti(requestDto.getMbti())
.statusMessage(requestDto.getStatusMessage())
.isDeleted(false)
.build();
}
public void update(MemberRequestDto.update requestDto) {
this.password = requestDto.getPassword();
this.username = requestDto.getUsername();
this.mbti = requestDto.getMbti();
this.statusMessage = requestDto.getStatusMessage();
}
public void uploadAvatar(String url) {
this.avatar = url;
}
}
In update method, Does the query occur if the column value of requestdto is already the same as the entity?