Problem setting value of a mysql BIT field

Asked

Viewed 200 times

0

Use Java + Hibernate in my systems, I created an attribute boolean to determine whether a user is an administrator: private boolean isAdmin;

The Hibernate generates tables and fields, and this isAdm field becomes the type BIT in the MySQL. In the version I have installed on my machine I can get into WorkBench and set values manually, eg:

inserir a descrição da imagem aqui

On the local machine where I have the version 5.6.23 of MySQL works, but on the server where I have installed the version 5.7.10 I have the following error when trying to assign 1 in the isAdm field:

Operation failed: There was an error while Applying the SQL script to the database. Executing: UPDATE auditoriabd.usuario SET isAdm='1' WHERE id='2';

ERROR 1406: 1406: Data Too long for column 'isAdm' at Row 1 SQL Statement: UPDATE auditoriabd.usuario SET isAdm='1' WHERE id='2'

How can I solve this problem? Does the problem occur because of the versions of MySQL be different?

  • tried to set column Definition of attribute to BIT ? ex: @Column(columnDefinition = "BIT") ?

  • Not yet, for this I would have to work a lot on the structure of the system. I found a possible solution, I will test.

  • No need to touch anything rs, just put this definition that I spoke on top of the attribute of your class :o)

  • I’ll try, I was looking for a solution in the bank.

  • @wryel didn’t work out

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.