It all started with this error message :

JDBCExceptionReporter - SQL Error: 0, SQLState: 01004
[14 Feb 2007 00:26] ERROR - JDBCExceptionReporter - Data truncation: Out of range value adjusted for column 'USER_STREAMING' at row 1

further investigation found that only “Boolean” property was having this problem. I was using MySQL 5, and hbm2ddl was mapping a “Boolean” property I had on my POJO to a “Bit”, before (on MySQL4) the hbm2ddl Ant task was mapping “Boolean” into “TinyInt(1)”

Changing the column type from “Bit” to “TinyInt(1)” manually on MySQL,  made the error go away. However, I still wanted to avoid manually changing my generated ddl script… I really like xdoclet/hbm2ddl combination (annotations are even better… but later..) and according to this you cn use the “sql-type” to specify the sql type that hbm2ddl can pick up.

So in all, I just had to change my xdoclet tags to:

/**
* @hibernate.property
* @hibernate.column name="USER_
STREAMING" sql-type="BOOLEAN"
*/

That’s all…

Advertisements