当前使用版本(必填,否则不予处理)

3.5.2

该问题是如何引起的?(确定最新版也有问题再提!!!)

@ToString @EqualsAndHashCode @Data @TableName(schema = "public", value = "aa") @Entity @Table(schema = "public", name = "aa",uniqueConstraints = {@UniqueConstraint(columnNames = {"name","version"})}) public class Aa implements Serializable {

private static final long serialVersionUID = 1L;
@TableId(type = IdType.AUTO)
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(length = 64, nullable = false)
private String name;
@Column(length = 64, nullable = false)
private Integer version;
@Column(columnDefinition = "text")
private String description;
private Integer type;
private Boolean encryption;

}

重现步骤(如果有就写完整)

INSERT INTO public.aa (id, description, encryption, name, type, version) VALUES (1, 'farnesback', false, 'optical_flow', 2, 1); INSERT INTO public.aa (id, description, encryption, name, type, version) VALUES (2, 'dualasf_tvl1', false, 'optical_flow', 2, 2); INSERT INTO public.aa (id, description, encryption, name, type, version) VALUES (3, 'didfs', false, 'optical_flow', 2, 3); INSERT INTO public.sy_cfg_model_information (id, description, encryption, name, type, version) VALUES (4, 'badrox', false, 'optical_flow', 2, 4); INSERT INTO public.aa (id, description, encryption, name, type, version) VALUES (5, 'pyrfsa_lk', false, 'optical_flow', 2, 5); INSERT INTO public.aa (id, description, encryption, name, type, version) VALUES (6, 'navisfadia_of', false, 'optical_flow', 2, 6); INSERT INTO public.aa (id, description, encryption, name, type, version) VALUES (23, 'guaasdrdrail classification', true, 'guardrailasfaclassification', 0, 2); INSERT INTO public.aa (id, description, encryption, name, type, version) VALUES (27, 'lp asd color in the lp snap', true, 'lp_ascolor', 1, 2); 然后使用mybatis-plus重新插入数据

报错信息

org.springframework.dao.DuplicateKeyException:

Error updating database. Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "sy_cfg_model_information_pkey"

详细:Key (id)=(1) already exists.

The error may exist in mapper/aaMapper.java (best guess)

The error may involve mapper.aaMapper.insert-Inline

The error occurred while setting parameters

SQL: INSERT INTO public.aa ( name, version, description, type, encryption ) VALUES ( ?, ?, ?, ?, ? )

Cause: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "aa_pkey"

详细:Key (id)=(1) already exists. ; ERROR: duplicate key value violates unique constraint "aa_pkey" 详细:Key (id)=(1) already exists.; nested exception is org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "aa_pkey" 详细:Key (id)=(1) already exists.

Comment From: huayanYu

无法复现,给出详细的步骤过程或者demo