Problem with date field in the form (Cuba Platform v7.1)

Hi,

After upgrading the platform to version 7.1, I get an exception in a form with a date field

<dateField id="xxxDateField" property="xxxDate" dateFormat="yyyy-MM-dd" width="100%" datatype="date"/>

java.lang.IllegalArgumentException: ValueSource and Datatype have different types. ValueSource:class java.util.Date; Datatype: class java.sql.Date
at com.haulmont.cuba.gui.components.data.DataAwareComponentsTools.checkValueSourceDatatypeMismatch(DataAwareComponentsTools.java:186)

When I remove the dataType=“date” from an xml file or change the dataType to “dateTime”, the exception is not displayed.

Regards
Marcin

Hi,

It seems that your entity’s attribute has TemporalType equal to TIMESTAMP, i.e. stores date and time so that you get the correct exception because the datatype attribute isn’t supposed to control DateField resolution. In case you want to exclude TimeField add resolution="DAY" for the DateField. Alternatively, consider changing attribute type from DateTime to Date.

Regards,
Gleb

Hi,

Thank you very much.

Regards
Marcin