0

I am using Hibernate in my Spring application. I'm inserting the Nft object into my database. But after when i changed the "sellStatus" column to "false" or "1" it says "Data too long for column" .

Heres my entity:

@Entity
@Table(name = "nft")
@Data
public class Nft {

    @Id
    private Long id;

    private String name;

    private String qtype;

    private int serial;

    private Long cost;

    private boolean sellStatus;

And this is the error :

ERROR 1406: 1406: Data too long for column 'sell_status' at row 1
SQL Statement:
UPDATE `nftbazaar`.`nft` SET `sell_status` = '1' WHERE (`id` = '1')
Emre Varol
  • 196
  • 2
  • 6
  • 18

1 Answers1

0

Change your sql from:

UPDATE `nftbazaar`.`nft` SET `sell_status` = '1' WHERE (`id` = '1')

To:

UPDATE `nftbazaar`.`nft` SET `sell_status` = true WHERE (`id` = '1')

OR

UPDATE `nftbazaar`.`nft` SET `sell_status` = false WHERE (`id` = '1')

Depending on your need to deal with true or false for boolean. Let the database handle your true or false to 0 or 1.

Ajay Kumar
  • 2,906
  • 3
  • 23
  • 46