Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ERROR: relation "hibernate_sequence" does not exist

I do not want to use autoincrement id. I have this table in PostgreSQL:

CREATE TABLE public.project
(
    id character varying(255) COLLATE pg_catalog."default" NOT NULL,
    name character varying(255) COLLATE pg_catalog."default" NOT NULL,
    number bigint NOT NULL,
    state character varying(255) COLLATE pg_catalog."default",
    CONSTRAINT project_pkey PRIMARY KEY (id)
)

And I have this model:

@Entity
@Table(name = "project")
@JsonIgnoreProperties({ "hibernateLazyInitializer", "handler" })
public class Project {

@Id
@Column(name = "id")
private String id;

@Column(name = "name")
private String name;

@Column(name = "number")
private BigInteger number;

@Column(name = "state")
private String state;

I want to use simple ID I do not want to use autoincrement and hibernate_sequence, and do not understand where I wrong.

And I have error: ERROR 11088 --- [ restartedMain] o.h.engine.jdbc.spi.SqlExceptionHelper : ERROR: relation "hibernate_sequence" does not exist

like image 236
SIn san sun Avatar asked Mar 12 '26 03:03

SIn san sun


1 Answers

In our entity you should use @GeneratedValue(strategy = GenerationType.IDENTITY) on your id especially if your table will autoincrement id.

like image 130
mohamed sandwidi Avatar answered Mar 14 '26 18:03

mohamed sandwidi



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!