Hibernate – How to set boolean value in hibernate

hibernate

This is the bean,

public boolean paid;
public boolean isPaid()
{
    return paid;
}
public void setPaid(boolean paid)
{
    this.paid=paid;
}

But when i create an object to save in database like,

CourseFee fee=new CourseFee();
fee.setPaid(false);
hibernateTemplate.save(fee);

I get the following exception,

java.sql.BatchUpdateException: Data too long for column 'paid' at row 1

Which is the correct way to set boolean values in hibernate?

Best Solution

I use this way.

@Column(name="isAdmin", columnDefinition = "tinyint default false")
public boolean isAdmin() {
   return admin;
}
Related Question