I understand that @MappingTarget must be accompanied by a @Setter.
However, for safety reasons I don't want to use @Setter for Entity.
Assuming that the fields of the Update Entity and the fields of the DTO are the same, is there a way to achieve the same effect as using @MappingTarget without using @Setter?
@Entity(name = "ad_config")
public class AdConfigEntity extends BaseEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private int adBannerId;
private String adBannerTitle;
private String adType;
private String adCategory;
}
and
@AllArgsConstructor
@Getter
public static class UpdateDto {
private String adType;
private String adCategory;
}
and Don't have mapper (I don't know way)
void updateEntity(AdConfigDto.UpdateDto updateDto, @MappingTarget AdConfigEntity adConfig);
I get the same effect as this code. But it's not usable.
I don't want to use setters on entities.