SmartClient Version: v10.0p_2016-02-18/PowerEdition Deployment (built 2016-02-18)
Isomorphic SmartClient/SmartGWT Framework (v10.0p_2016-02-18/PowerEdition Deployment (built 2016-02-18))
Browser: Chrome
I have a workaround for this so it is not urgent, and you may say it is expected behavior because we are misusing our datasource definitions, but thought I would pass it on anyway...
Fields defined with the same nativeName attribute in a DataSOurce are causing a Class Cast Exception during insert/update.
For reasons we don't need to go into, we have some fields that are defined in a datasource that have the same nativeName attribute. The duplicate field definition is marked canSave="false" because clearly we can't expect the framework to make a judgment of which value we'd like it to use to update the field when saving a record.
The framework maintains a couple of maps for SQLDataSources to relate datasource field names to native table column names, and vice versa.
When constructing the native2DSFieldMap, if there is more than one datasource field with the same nativeName attribute then the map entry ends up containing an array of strings instead of a string. E.g. ProductionDelivery datasource defines both _id_ and _deliveryId_ as having a nativeName="id". The resulting native2DSFieldMap entry for the native field name id looks like:
This array structure causes a class cast exception in SQLDataSource.getFieldNameFromColumnName() line 390 during construction of an insert (and I assume update) statement:
There are various means of suppressing the duplicate field from appearing in the map, of which I believe using a customSelectExpression is a straightforward and reasonable way to do this, but I would think that perhaps canSave="false" should also suppress it. Or perhaps there just needs to be better error handling/reporting when the insert fails rather than a Class Cast Exception...?
Isomorphic SmartClient/SmartGWT Framework (v10.0p_2016-02-18/PowerEdition Deployment (built 2016-02-18))
Browser: Chrome
I have a workaround for this so it is not urgent, and you may say it is expected behavior because we are misusing our datasource definitions, but thought I would pass it on anyway...
Fields defined with the same nativeName attribute in a DataSOurce are causing a Class Cast Exception during insert/update.
For reasons we don't need to go into, we have some fields that are defined in a datasource that have the same nativeName attribute. The duplicate field definition is marked canSave="false" because clearly we can't expect the framework to make a judgment of which value we'd like it to use to update the field when saving a record.
The framework maintains a couple of maps for SQLDataSources to relate datasource field names to native table column names, and vice versa.
When constructing the native2DSFieldMap, if there is more than one datasource field with the same nativeName attribute then the map entry ends up containing an array of strings instead of a string. E.g. ProductionDelivery datasource defines both _id_ and _deliveryId_ as having a nativeName="id". The resulting native2DSFieldMap entry for the native field name id looks like:
Code:
[id,deliveryId]
Code:
/* */ public String getFieldNameFromColumnName(String columnName) { /* 390 */ return (String)native2DSFieldMap.get(columnName); /* */ }
Comment