Filter on an Enum field throwing Illegal Argument Exception

Cuba platform version - 7.1.6

I have an enum ‘CastCategory’ whose values are defined as -
GENERAL("GENERAL"),OBC("OBC"),SC_ST("SC_ST");

In entity named ‘Patient’, I have defined a field ‘patientCast’ of type this enum ‘CastCategory’.
In Patient Browser screen, I am trying to filter out records by putting filter on this enum type field.

After selecting the value from dropdown and pressing Search button, Illegal Argument Exception is thrown stating that -
“You have attempted to set a value of type class java.lang.String for parameter filter_patientCast42250 with expected type of class com.enums.CastCategory”

How can I apply filter on a field of enum type?

Can anyone from Cuba forum team help me with the solution please?

Looks like an old bug.
Could you upgrade to the latest 7.2.20 or at least to 7.1.9?

I upgraded the project to 7.1.9 and still getting the same error.

To make it work, I have written a custom filter for this enum field with Param Type as String instead of Enum. This filter will accept string input like ‘General’, ‘OBC’.
I have defined ‘WHERE’ clause of this custom filter as

{E}.patientCast like (CASE ? WHEN 'General' then '0' 
                             WHEN 'OBC' then '1' 
							 WHEN 'SC/ST' then '2' 
							 ELSE '2' 
					  END)

But I am still not getting result. Is this also a version bug or something is wrong with my WHERE clause ?

@krivopustov Even after upgrading to the version 7.1.9 best possible as per my project, I am still not getting the desired result. So I created this custom filter which I have posted above. Can you please help me with my custom filter solution ?

I’ve tested your problem and couldn’t reproduce it.
Standard filtering by enum value works for me on 7.1.9.
Attached the project:
demo.zip (86.1 KB)

Please check again your data model. The field in the entity must be of type String, accessor methods must convert to/from enum, like this:

@Column(name = "STATUS")
private String status;

public Status getStatus() {
    return status == null ? null : Status.fromId(status);
}

public void setStatus(Status status) {
    this.status = status == null ? null : status.getId();
}

Thanks @krivopustov for the solution.
I wasn’t using accessor methods to convert String value to/from enum. I was directly declaring the field of type Enum.