Skip to content

Jpa Enum error with Smallint type in postgres

I want to put enum in my entity. But I have an error with validation which JPA wonts smallint set as enum. How I can solve this issue.

“Schema-validation: wrong column type encountered in column [status] in table [order]; found [int2 (Types#SMALLINT)], but expecting [int4 (Types#INTEGER)]”[enter image description here] enter image description here

enter image description here



Add columnDefinition=”int2″ at OrderStatus in your entity.

    @Column(name = "status", columnDefinition = "int2")
    OrderStatus status;

Tested on spring boot 2.2.10

9 People found this is helpful