1

I am using postgresql database ans using criteria method to query to my springboot app I have a table containing a field called status which is a text array field which can have values any or multiple of these "received,processed,failed,in-flight,unprocessed" ...

In an API i will be sending a list of status as input and need to retrieve data, if in the table if the field contains any of the input value then I need to return that. How can I implement this using Criteria in springboot java

For E.g. My table row has field status like {received,processed} and my input value is a list of values ["processed","failed"] and i need to retrieve the same row mentioned above. How to write java code for querying this using Criteria and Predicate

Abhi
  • 101
  • 6
  • It appears your list of input values is just a string separated values. You can convert this to an array (perhaps with string_to_array function) then use the [array overlaps operator](https://www.postgresql.org/docs/current/functions-array.html) (&&). Something like `where string_to_array(input_list, ',') && table.status` – Belayer Aug 13 '22 at 01:19
  • No in database it is a text[] field – Abhi Aug 16 '22 at 11:28

0 Answers0