When we instruct Hibernate to update [assigning the value of hibernate.hbm2ddl.auto as update] the tables based on the JPA entity classes, Hibernate converts a boolean (or Boolean class) to the Type Bit in MySQL.
For example, the following in an JPA entity class
@Column(name = "answer")
private Boolean answer;
is converted to a column as below in MySQL.
answer bit(1)
We may populate the value in Seam using the below code in the UI (JSF)
<h:selectBooleanCheckbox id="qanswer" value="#{qopt.answer}"/>
Now when we persist (save) the entity we may get the below exception
java.sql.SQLException: Data too long for column
Reason: Though Hibernate generated the table structure and designated the column type as bit for a boolean variable, there are some issues in storing the value in Type bit for MySQL.
Solution: Declare the column type as SMALLINT
For more informtion please refer http://opensource.atlassian.com/projects/hibernate/browse/HHH-468
