2
votes

I am trying to build a simple quarkus-panache example using postgresql. Postgres version is 12.2. My quarkus version is 1.3.1.Final. When using the sequence generator, I always get an error like this:

PSQLException: ERROR: relation "hibernate_sequence" does not exist

My entity class is like this:

@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;
}

and the corresponding table is this:

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;

What am I missing?

1

1 Answers

1
votes

If you want to use a custom ID strategy, you should extend PanacheEntityBase, not PanacheEntity.