Jmix Version 1.5
If you have a KeyValueCollection view page and run a search with multiple filters, then the resulting query is faulty. The ‘entityAlias’ is added when its not required.
i.e.
Running a search with a single filter creates the following query:
select customMaterial, customMaterial.material, customMaterial.material_Category1,
customMaterial.hw_type_category, materialUsecase, unitPrice from cmat_CustomMaterial
customMaterial left join customMaterial.materialUsecases materialUsecase left join
customMaterial.unitPrices unitPrice where customMaterial.material_Category1 =
:customMaterial_material_Category1pUiCmbKq order by
customMaterial.material_Category1.name, customMaterial.hw_type_category.name,
customMaterial.hw_type_sort, customMaterial.id, unitPrice.startDate
The where condition property is customMaterial.material_Category1 =
:customMaterial_material_Category1pUiCmbKq
However, running the search with two filters adds the entity name again in the where condition
select customMaterial, customMaterial.material, customMaterial.material_Category1,
customMaterial.hw_type_category, materialUsecase, unitPrice from cmat_CustomMaterial
customMaterial left join customMaterial.materialUsecases materialUsecase left join
customMaterial.unitPrices unitPrice where (customMaterial.customMaterial.material_Category1 =
:customMaterial_material_Category1pUiCmbKq and lower (
customMaterial.customMaterial.description_short_local) like
:customMaterial_description_short_localCIXiVKSr) order by
customMaterial.material_Category1.name, customMaterial.hw_type_category.name,
customMaterial.hw_type_sort, customMaterial.id, unitPrice.startDate
The where condition now has the entityName appended again (customMaterial.customMaterial.material_Category1), and doesn’t work.
where (customMaterial.customMaterial.material_Category1 =
:customMaterial_material_Category1pUiCmbKq and lower (
customMaterial.customMaterial.description_short_local) like
:customMaterial_description_short_localCIXiVKSr)
I’ve traced the bug to io.jmix.data.impl.jpql.generator.PropertyConditionGenerator.generateWhere() where the entityAlias is appended to the property name.
I added an issue at the jmix github page, with a link to a project zip file replicating the issue