I have a query like this that works well :
"SELECT * FROM elements we WHERE jsonb_exists_all(CAST(we.elements AS jsonb), ARRAY['TEST'])"
I need to use the .setParameter method from EntityManager to insert a whole array instead of ["CHEST"] e.g. ["TEST", "TEST1", "TEST2"]. It seems to me that .setParameter converts the argument into a string. So far I have only found a workaround for assigning 2 values to the same key:
String queryFromFilter = "SELECT * FROM elements we WHERE jsonb_exists_all(CAST(we.elements AS jsonb), ARRAY[:array])";
Query query = entityManager.createNativeQuery(queryFromFilter, Checklist.class);
return query
.setParameter("array", "TEST'")
.setParameter("array", "TEST")
.getResultList();
}