I have a BOOLEAN type in a MySQL table (TINYINT(1)) and I’m trying to map the boolean field in an entity but this generates an exception:
org.hibernate.HibernateException: Wrong column type in maegul.users for column admin. Found: bit, expected: boolean
I changed the field in my entity to byte and make the respective changes so it acts a boolean, and I get:
org.hibernate.HibernateException: Wrong column type in maegul.users for column admin. Found: bit, expected: tinyint
I tried using the @Type annotation on the field:
@Type(type = "org.hibernate.type.NumericBooleanType")
but I get:
org.hibernate.HibernateException: Wrong column type in maegul.users for column admin. Found: bit, expected: integer
From what I read here :
It seems Hibernate is expecting an integer and got a bit.
Which mean your annotation is now correct :
But maybe it has updated your database to set as Bit instead of integer, thus the error.
If you really need a TinyInt, you can use
@TypeAND@Column, to set as Integer, of type TinyInt :