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”
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 ?
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.