Null Values for all Number types

Hello, I’m facing this problem where binding any of Double, Integer, BigDecimal to a TextField gives me a null in the database. No errors or exceptions are throw. Code:

public class MyBean{
private BigDecimal myFigure;
//getters/setters
}

TextField myFigure = new TextField(“Figure”);
myFigure.setConverter(new StringToBigDecimalConverter());

That’s a sample of my code. Doesn’t work. Neither does changing everything to Double, Integer. What am I doing wrong.

Any figure entered in the textfield simply gets bound as null when persisted to the database.

I’m not sure I follow your code logic, there is nothing binding the BigDecimal value to the field. Try adding this:

myFigure.setPropertyDataSource(new BeanItem(bean).getItemProperty(“myFigure”));

Hi. Actually MyBean has other properties that have been bound to MyBeanForm using BeanFieldGroup. The testfield is part of the properties of MyBeanForm. All the other fields work just fine. Only the bigdecimal field is null

I mean only the bigdecimal textfield returns null even after setting the converter on it

OK somehow after restarting my machine the conversion works. Before where attaching it impicitly as per the Book of Vaadin or explicitly, it didn’t work. After the reboot it’s working. I did not do any refactorings. Thanks for your time