ElementCollectionTable conversion exception

Hi,

I have a AbstractForm from Viritin addon for a shop entity. The shop entity has many ShopEquipment which refers to an Equipment entity, a quantity and a price. I have two subclasses : Belt and Bracer which inherit the abstract class Equipment. The Belt and Bracer classes have no other private member than those in Equipment class. They are only distinct by a JPA DiscriminatorValue.

I represent that in my form by an ElementCollectionTable.

Here is a row of that table

public static class ShopEquipmentRow { TypedSelect<Equipment> equipment = new TypedSelect<Equipment>(); IntegerField quantity = new IntegerField(); IntegerField unitPrice = new IntegerField(); } When I add, for example, an equipment of type “Bracer” in the ElementCollectionTable row, everything is fine.
Then when I add another equipment of type “Belt” I have a conversion exception.
Why is there a conversion exception since they are both Equipment objects?

com.vaadin.data.util.converter.Converter$ConversionException: Unable to convert value of type data.Bracer to presentation type class data.Belt. No converter is set and the types are not compatible.

OK I figured it out with Matti’s help. Simply added the class as parameter to the TypedSelect. Problem solved.

new TypedSelect<Equipment>(Equipment.class);