Create entities with association one to many. Select Set type for collection field.
Add TagField to the editor, for instance:
<tagField id="tagPicker"
dataContainer="veterinarianDc"
property="specialties">
<query entityClass="io.jmix.petclinic.entity.veterinarian.Specialty"
escapeValueForLike="true"
searchStringFormat="%${searchString}%">
<![CDATA[select e from petclinic_Specialty e where lower(e.name) like lower(:searchString) escape '\']]>
</query>
</tagField>
Add some values to the TagField and try to save entity.
AR
Caused by: java.lang.ClassCastException: class java.util.ArrayList cannot be cast to class java.util.Set (java.util.ArrayList and java.util.Set are in module java.base of loader 'bootstrap')
at io.jmix.core.metamodel.model.utils.MethodsCache$SettersHolder.accept(MethodsCache.java:188) ~[jmix-core-1.0.0.jar:na]
at io.jmix.core.entity.BaseEntityEntry.setAttributeValue(BaseEntityEntry.java:104) ~[jmix-core-1.0.0.jar:na]
at io.jmix.core.entity.EntityValues.setValue(EntityValues.java:73) ~[jmix-core-1.0.0.jar:na]
at io.jmix.core.entity.EntityValues.setValueEx(EntityValues.java:198) ~[jmix-core-1.0.0.jar:na]
at io.jmix.core.entity.EntityValues.setValueEx(EntityValues.java:151) ~[jmix-core-1.0.0.jar:na]
at io.jmix.ui.component.data.value.ContainerValueSource.setValue(ContainerValueSource.java:170) ~[jmix-ui-1.0.0.jar:na]
at io.jmix.ui.component.data.value.ValueBinder$ValueBindingImpl.setValueToSource(ValueBinder.java:316) ~[jmix-ui-1.0.0.jar:na]
at io.jmix.ui.component.data.value.ValueBinder$ValueBindingImpl.componentValueChanged(ValueBinder.java:309) ~[jmix-ui-1.0.0.jar:na]
at io.jmix.core.common.event.EventHub.publish(EventHub.java:170) ~[jmix-core-1.0.0.jar:na]
at io.jmix.ui.component.impl.AbstractComponent.publish(AbstractComponent.java:85) ~[jmix-ui-1.0.0.jar:na]
at io.jmix.ui.component.impl.AbstractValueComponent.componentValueChanged(AbstractValueComponent.java:154) ~[jmix-ui-1.0.0.jar:na]
at io.jmix.ui.component.impl.AbstractField.lambda$attachValueChangeListener$ab1c93c8$1(AbstractField.java:145) ~[jmix-ui-1.0.0.jar:na]
QA
Create two entities with one-to-many association;
Use Set collection type;
Add TagField to the editor and try to select some values, for instance:
<tagField id="orderLinesField" property="orderLines">
<query entityClass="com.company.app.entity.OrderLine"
escapeValueForLike="true"
searchStringFormat="%${searchString}%">
<![CDATA[select e from OrderLine e where e.name like :searchString escape '\']]>
</query>
</tagField>
Save entity - there is no exception should occur.
Try to use #setTagComparator. No exception should occur.
Another case try to change collection type to List and try to edit entity's collection field. No exception should occur.
Description
AR
QA
Set
collection type;#setTagComparator
. No exception should occur.Another case try to change collection type to
List
and try to edit entity's collection field. No exception should occur.