'How to call a function using JPA Criteria API?

I am creating a specification which returns the records for the ids provided by the db function GET_RECORD_IDS. I am providing my code snippet below-

return ((root, query, criteriaBuilder) -> criteriaBuilder.and(root.get("id").in(
criteriaBuilder.function("GET_RECORD_IDS", List.class, criteriaBuilder.literal(str))))

But this code results in the error set-returning functions are not allowed in WHERE. How do I make this work?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source