Problems about form validation

Hi, I created a form extending FormLayout like this:

BeanFieldGroup<MyClass> binder = new BeanFieldGroup<MyClass>(MyClass.class);
binder.setItemDataSource(new MyClass());
TextField name = new TextField("name");
name.setNullRepresentation("");
name.setImmediate(true);
binder.bind(name, "name");
addComponent(name);

MyClass has an annotation on field name; @Size(min=3).
But when I call binder.commit() I don’t get any error if I put an empty string. Nothing happens.

is your property nullable ?
if it should not be null add @NotNull(message = “name cannot be null”)

Just setting @Size(min=3) does not preclude null values…

I tried, it does not work.

Any help??