我正在尝试使用postgresql构建一个简单的quarkus-panache示例。Postgres版本是12.2。我的quarkus版本是1.3.1 quarkus。在使用序列生成器时,我总是得到这样的错误:
PSQLException: ERROR: relation "hibernate_sequence" does not exist
我的实体类是这样的:
@Entity
public class Movie extends PanacheEntity {
@Id
@GeneratedValue(generator = "movie_id_seq", strategy = GenerationType.SEQUENCE)
@SequenceGenerator(
name = "movie_id_seq",
sequenceName = "movie_id_seq",
allocationSize = 50
)
private Integer id;
public String title;
public String director;
public String genre;
}相应的表格如下:
create table movie (
id integer primary key,
title varchar(255) not null,
director varchar(255) not null,
genre varchar(50) not null
);
create sequence movie_id_seq increment 50 START 1 MINVALUE 1;我遗漏了什么?
发布于 2020-04-07 03:07:20
如果您希望使用自定义ID策略,则应该扩展PanacheEntityBase,而不是PanacheEntity。
https://stackoverflow.com/questions/61058374
复制相似问题