Felipe Cypriano You are about to read it

9Oct/090

Solving Grails/GORM data truncation error on blob column using Java

Today GORM was in a bad mood and refuses to insert a text in a blob (clob) column. If a set a non null value in the attribute which was mapped to a blob field I end up with this strange error:

Caused by: java.sql.DataTruncation: Data truncation

Data truncation for a blob column makes no sense since blobs are made to handle large amount of data, as far as I know the limit is your storage space.

What I needed was an improved version of the Setting class that cames with settings plugin, I wanted to store large texts in some settings, larger the 100 characters which is the current limit, so I create a new attribute to store large texts, this new attribute is a blob in the dabase.