I have a KeyValueCollection to select a list of option items and its descriptions.
<keyValueCollection id="prodLnDc">
<loader id="prodLnDl">
<query>
<![CDATA[select e.id.cdValue, e.descr from test1_Sy99refCodes e where e.id.cd = 'PRODLN']]>
</query>
</loader>
<properties idProperty="prodLn">
<property datatype="string" name="prodLn"/>
<property datatype="string" name="descr"/>
</properties>
</keyValueCollection>
I used this in my lookupField:
<lookupField id="prodLnField" property="prodLn"
optionsContainer="prodLnDc"
captionProperty="descr"/>
The screen shows the option descriptions and when I tried to update the property prodLn which is a String, it gives an error:
ClassCastException: com.haulmont.cuba.core.entity.KeyValueEntity cannot be cast to java.lang.String
How do I get the KeyValueCollection to return the option key (prodLn) string ?