Map a tinyint as boolean hibernate
Better use BIT(1)
instead of TINYINT(1)
@Column(nullable = false, columnDefinition = "BIT", length = 1)
private boolean flag = false;
From what I read here :
org.hibernate.HibernateException: Wrong column type in maegul.users for column admin. Found: bit, expected: integer
It seems Hibernate is expecting an integer and got a bit.
Which mean your annotation is now correct :
@Type(type = "org.hibernate.type.NumericBooleanType")
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 @Type
AND @Column
, to set as Integer, of type TinyInt :
@Column(columnDefinition = "TINYINT")
@Type(type = "org.hibernate.type.NumericBooleanType")
public boolean admin = true;