I have a spring boot java application which uses postgresql has a table with text[] column 'groups'. Let the values of the column
| Groups(text[]) |
|---|
| Group1,Group2 |
| Group2 |
| Group1 |
| Group3 |
My input value will be an arraylist of Group1,Group2 and I need to add this to the where condition in query and fetch the data. The return data must be having the first 3 rows. Please help in writing a query using JPA criteria and Predicate and all.
I am known about query but here I need it be created using CriteriaBuilder and Predicate the query I found is like this
select * from table where exists (select * from unnest(groups) n where n like any (array['Group1','Group2']));
I need to change this in to java code which uses criteria and predicate
Thanks in Advance