Could not convert value to Number

I have created a simple form with an underlying Object that binds to the form but I get this error in the id field.
Here is the code :

Person class

package pojo;

import java.util.Date;

public class Person {

    private final Long id;
    private String firstName;
    private String lastName;
    private Date birthDate;

    public Person(Long id) { = id;

    //getters and setters
    public Long getId()
        return id;

    public String getFirstName() {
        return firstName;

    public void setFirstName(String firstName) {
        this.firstName = firstName;

    public String getLastName() {
        return lastName;

    public void setLastName(String lastName) {
        this.lastName = lastName;

    public Date getBirthDate() {
        return birthDate;

    public void setBirthDate(Date birthDate) {
        this.birthDate = birthDate;

PersonUI class

package vaadin;

import com.vaadin.server.VaadinRequest;
import com.vaadin.ui.*;
import pojo.Person;

import java.util.Date;

public class PersonUI extends UI {
    protected void init(VaadinRequest vaadinRequest) {

        Person person = new Person(1L);

        person.setBirthDate(new Date(0));

        BeanItem<Person> item = new BeanItem<Person>(person);

        FieldGroup group = new FieldGroup(item);

        Field<?> id = group.buildAndBind("id");
        Field<?> firstName = group.buildAndBind("firstName");
        Field<?> lastName = group.buildAndBind("lastName");
        Field<?> birthdate = group.buildAndBind("birthDate");

        FormLayout layout = new FormLayout(id, firstName, lastName, birthdate);



Result :


You need a converter. If your ids will be small enought for Integers, you could use

((TextField) id).setConverter(new StringToIntegerConverter());

Otherwise you have to implement your own StringToLongConverter.

The problem is that the default Converter for longs used to be StringToNumberConverter, which is rather broken. Your code should work as-is on Vaadin 7.1.8 which backported StringToLongConverter from the 7.2 branch:
ticket #12225

Wow, I’ve upgraded the maven vaadin version from 7.1.7 to 7.1.8 and the error message disappeared!