Error on saved filter with BaseIntegerIdEntity


I have an issue with previously saved filters.
In my project I have an entity(NewEntity_1), which have an attribute(a) of another entity(NewEntity). Both entities extend BaseIntegerIdEntity.
I open the browser of NewEntity_1 and create a filter of the attribute ‘A’. I choose the NewEntity named ‘asd’.
All works fine.
After this I save the filter with values.
I reopen the browser, choose the previously saved filter from the filters. I get this error:

java.lang.IllegalArgumentException: Invalid UUID string: 1
at java.util.UUID.fromString(
at com.haulmont.cuba.gui.components.filter.Param.loadEntity(
at com.haulmont.cuba.gui.components.filter.Param.parseSingleValue(
at com.haulmont.cuba.gui.components.filter.Param.parseValue(
at com.haulmont.cuba.gui.components.filter.condition.AbstractCondition.resolveParam(
at com.haulmont.cuba.gui.components.filter.condition.AbstractCondition.(
at com.haulmont.cuba.gui.components.filter.condition.PropertyCondition.(
at com.haulmont.cuba.gui.components.filter.FilterParserImpl.createCondition(
at com.haulmont.cuba.gui.components.filter.FilterParserImpl.recursiveFromXml(
at com.haulmont.cuba.gui.components.filter.FilterParserImpl.getConditions(
at com.haulmont.cuba.gui.components.filter.FilterDelegateImpl.setFilterEntity(
at com.haulmont.cuba.gui.components.filter.FilterDelegateImpl$7.actionPerform(

The problem:
LoadContext ctx = new LoadContext(javaClass).setId(UUID.fromString(id));

Filter xml:

<c name=“a” class=“” operatorType=“EQUAL” width=“1” type=“PROPERTY”>
<param name=“component$filter.a12313” javaClass=“”>1

Can you suggest any workarounds and can you fix this bug in the later versions?

Hi Julia,

It seems you’ve confused the visual component Filter and the datasource query filter. You don’t need to modify the screen descriptor, just select “Save with values” and then “Make default” in the Filter editor in your application, and the browse screen will always be opened with the filtered data.

Hi Olga!

Thanks for your reply. :slight_smile:
I appreciate you trying to help, but I don’t see why making it default would change anything :smiley:
(for the record we did make the same filter default and that only made the error always pop up when the browse screen is opened and the table not filtered at all)
I thought I clearly stated that I didn’t change anything in the screen descriptor…
That’s the xml that was saved in the db in the sec_filter table…

But as usual if there is a bug I have to hack around it 'cause no version upgrade fixes it :slight_smile:
I ended up writing a BeforeInsertEntityListener<FilterEntity> and manualy changeing the filter xml. It looks awful but at least it’s working and not throwing errors.
If anyone needs it:

public class FilterEntityListener
    implements BeforeInsertEntityListener<FilterEntity>, BeforeUpdateEntityListener<FilterEntity> {
public void onBeforeInsert(FilterEntity entity, EntityManager entityManager) {

public void onBeforeUpdate(FilterEntity entity, EntityManager entityManager) {

private String fixIntegerID(String xml) {
    String[] c = xml.split("<c");
    String intParam = "";
    for (String x : c){
        if(x.contains("class=\"") && x.contains("operatorType=\"EQUAL\"")){
            intParam = x;
            String classSearch = "class=\"";
            String classString = x.substring(x.indexOf(classSearch) + classSearch.length(), x.indexOf("\"", x.indexOf(classSearch) + classSearch.length()));
            intParam = intParam.replaceAll(classString, "java.lang.Integer");
            String nameSearch = "name=\"";
            String nameString = x.substring(x.indexOf(nameSearch), x.indexOf("\"", x.indexOf(nameSearch) + nameSearch.length()));
            intParam = intParam.replace(nameString, nameString + ".id");
            xml = xml.replace(x,intParam);
    return xml;


Thank you for reporting the bug, we’ve reproduced it and created an issue on GitHub to fix it.

1 Like

Thank you :slight_smile: