1

i have a query where i check first if the input parameter(list<string>) is null or i set the condition to pass input parameter in where condition of the query

Ex:

@Query(value = SELECT * FROM employee t WHERE (((:employeeNameList) is  null) or  ((:employeeNameList) is not null and t.emp_name  IN (:employeeNameList) )", nativeQuery = true) 

Page<Employee> findAllData(Pageable pageable, @Param("employeeNameList")List<String> employeeNameList);

the above query is failing when i pass null value as input with the below error

ERROR: operator does not exist: character varying = bytea Hint: No operator matches the given name and argument type(s). You might need to add explicit type casts. Position: 126".

It works fine when i pass list which contain some string values.

Apoorva
  • 11
  • 2

0 Answers0