0

I am currently attempting to search by regular expression using CriteriaBuilder.

Here is the query I want to generate
select * from table where column ~ '.*';

Then I tried using 'criteriaBuilder.function()'.

Expression<String> expression = root.get("column");  
Expression<String> regex = criteriaBuilder.function("~", String.class, expression.as(String.class),criteriaBuilder.literal(regexValue)); 

This was an error because '~' is an operator, not a function.
Is there any way to achieve a regular expression search with ~ in CriteriaBuilder?

fooo19
  • 1

0 Answers0