小编Ain*_*100的帖子

有没有办法防止 MapStruct 在记录更新期间覆盖值?

我看到2018年有一个类似的问题: Mapstruct to update value without overwriting,但没有解决这个问题的例子。

因此,我不知道如何解决它。

我正在使用LombokMapStruct

UserEntity代表数据库中的表

@Getter
@Setter
@Entity
@Table(name = "users")
public class UserEntity implements Serializable {

    private static final long serialVersionUID = -3549451006888843499L;

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)     // this specifies that the id will be auto-incremented by the database
    private Long id;
    
    @Column( nullable = false)
    private String userId;
    
    @Column( nullable = false, length = 50)
    private String firstName;
    
    @Column( nullable = false, length = 50)
    private String lastName; …
Run Code Online (Sandbox Code Playgroud)

java mapping spring spring-boot mapstruct

2
推荐指数
1
解决办法
3230
查看次数

标签 统计

java ×1

mapping ×1

mapstruct ×1

spring ×1

spring-boot ×1