PostgreSQL next value of the sequences?

后端 未结 7 1816
天命终不由人
天命终不由人 2020-12-01 14:20

I am using PostgreSQL for my Codeigniter website. I am using grocery crud for add, edit and delete operations. While doing an edit or add, I want to rename an uploaded file

7条回答
  •  不思量自难忘°
    2020-12-01 14:30

    I tried this and it works perfectly

    @Entity
    public class Shipwreck {
      @Id
      @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "seq")
      @Basic(optional = false)
      @SequenceGenerator(name = "seq", sequenceName = "shipwreck_seq", allocationSize = 1)
      Long id;
    

    ....

    CREATE SEQUENCE public.shipwreck_seq
        INCREMENT 1
        START 110
        MINVALUE 1
        MAXVALUE 9223372036854775807
        CACHE 1;
    

提交回复
热议问题