Hibernate 6.6 REGEXP support

Hi everyone.
I am using Hibernate 6.6.1 with MySQL 8.

I am currently refactoring a query that required to split a string by SPACE char and run multiple LIKE %% comparisons over multiple fields. The query uses HQL in the old version, and as you can imagine, this requires a bunch of lines of code, and it also makes the query text long.
It is my intention to use REGEXP in the refactoring.

I wanted to know if there is a nice, elegant way to use the REGEXP function with HQL (or with the CRITERIA API), to avoid using NATIVE queries.

Thank you
Jack

Sure, just create your own FunctionContributor and register that function. In fact, you can also even just use the function directly in HQL if you want e.g. ... where regexp_like(entity.textAttribute, '^\w+$')=1.