Database TEXT field, java.sql.Clob, Textarea/Text problem

I have database field which is TEXT and my hibernate gets that as java.sql.Clob and in my form it is shown as a TextField.

When I do save with Form commit() method, it throws this error:$SourceException
at com.vaadin.ui.Form.commit(

Caused by:$SourceException
at com.vaadin.ui.AbstractField.commit(
at com.vaadin.ui.Form.commit(
… 28 more
Caused by:$ConversionException: java.lang.NoSuchMethodException: java.sql.Clob.(java.lang.String)

Did anyone see the error ?

To recreate this problem
create table myfoo (
notes TEXT

public class MyFoo {
private Clob notes;

Create a form to display this and have save button doing the commit()


This means that the textfield’s (textarea) data type, which is String, cannot be transformed into a Clob. You need to do this conversion yourself.

The easiest way is by introducing a getter/setter in your MyFoo class that accept String parameters and save that string into your Clob object. Another way would be to wrap MyFoo in a delegate class that contains the same string->clob logic and is used in the UI.

A third way, not requiring you to change or wrap your data object, would be to create your own kind of Property that does the conversion for you. But I think this would make for more complex code in the long run.