Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 816
YWILLS Avatar asked Oct 14 '25 22:10

YWILLS


1 Answers

Add columnDefinition="int2" at OrderStatus in your entity.

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

Tested on spring boot 2.2.10

like image 96
Shawrup Avatar answered Oct 17 '25 11:10

Shawrup



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!