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:
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
SETisAdm
='1' WHEREid
='2';ERROR 1406: 1406: Data Too long for column 'isAdm' at Row 1 SQL Statement: UPDATE
auditoriabd
.usuario
SETisAdm
='1' WHEREid
='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") ?
– wryel
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.
– DiegoAugusto
No need to touch anything rs, just put this definition that I spoke on top of the attribute of your class :o)
– wryel
I’ll try, I was looking for a solution in the bank.
– DiegoAugusto
@wryel didn’t work out
– DiegoAugusto