Map a tinyint as boolean hibernate

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;

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)