I am using jpa-buddy to generate liquibase changelog (sql format) from jpa (hibernate) entities. I am using hibernate-types-55 to map java Enum to posgres Enum. I do this as follow:
@Entity
@TypeDef(
name = "pgsql_enum",
typeClass = PostgreSQLEnumType.class
)
public class MyEntity {
@Enumerated(EnumType.STRING)
@Type(type = "pgsql_enum")
private MyEnumType myEnum;
}
The generated DDL with jpa-buddy is:
CREATE TABLE my_entity
(
my_enum VARCHAR(255),
);
when remove
@Enumerated(EnumType.STRING)
I get
CREATE TABLE my_entity
(
my_enum UNKNOWN__COM.VLADMIHALCEA.HIBERNATE.TYPE.BASIC.POSTGRESQLENUMTYPE,
)
The problem is I can't generate postgres enum type from entity.
what I am expecting is a generated DDL like:
create type my_enum_type as enum ('ENUM1', 'ENUM2', 'ENUM3');
CREATE TABLE my_entity (
my_enum my_enum_type,
);
Has anyone managed to do this in the past ?
Thank you