Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

quarkus panache and postsgresql sequence error

Tags:

quarkus

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?

like image 280
Kelly Goedert Avatar asked Jun 04 '26 09:06

Kelly Goedert


1 Answers

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

like image 115
Guillaume Smet Avatar answered Jun 08 '26 01:06

Guillaume Smet



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!