@JsonProperty("id")
@Column(name = "id", nullable = false)
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY,generator = "order_seq_gen")
@SequenceGenerator(name = "order_seq_gen", sequenceName ="order_id_seq")
private Integer id;
@JsonProperty("state")
private String state;
@JsonProperty("user_Id")
@Column(name = "user_Id", nullable = false)
@GeneratedValue(strategy = GenerationType.IDENTITY,generator = "user_seq_gen")
@SequenceGenerator(name = "user_seq_gen", sequenceName ="user_id_seq")
private Integer userId;
这是我的创建表语句
CREATE TABLE public.user
(
id integer NOT NULL DEFAULT nextval('user_id_seq'::regclass),
created timestamp without time zone,
modified timestamp without time zone,
state character varying(255),
name text,
user_id integer NOT NULL DEFAULT nextval('user_id_seq'::regclass), CONSTRAINT user_pkey
PRIMARY KEY (id)
)
以下是我的序列。
CREATE SEQUENCE public.user_id_seq INCREMENT 1 MINVALUE 6001
MAXVALUE 9223372036854775807 START 6000 CACHE 1;
ALTER TABLE public.user_id_seq OWNER TO postgres;
我尝试的是在我的表中,user_id列应该从Base生成Auto为6000并且每次增加1。
每当我从我的服务中调用API时,它就会创建新记录。但是user_id没有显示任何内容。