JPA Entity class giving error with 2 @GeneratedValue fields

后端 未结 2 1381
遥遥无期
遥遥无期 2021-01-28 13:25

I have two columns which will use @GeneratedValues, but when I am putting them like this it is giving error; \" Exception Description: Class [class Testing] has two @GeneratedVa

2条回答
  •  感情败类
    2021-01-28 13:54

    Using columnDefinition="serial" with Postgresql it works for me.

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;
    
    @Column(columnDefinition="serial")
    @Generated(GenerationTime.INSERT)
    private Long seqNo;
    

提交回复
热议问题