Hibernate 7.2 introduces a native `like regexp` operator in HQL, enabling regex-based string matching directly in queries without resorting to native SQL. The operator is translated by each database dialect to its native regex function (e.g., `REGEXP_LIKE` in Oracle, `~` in PostgreSQL, `REGEXP` in MySQL). A Spring Boot example with H2 demonstrates both `like regexp` and `not like regexp` usage. Key caveat: while the HQL syntax is portable across dialects, the regex flavor depends on the underlying database engine, so patterns written for H2 may not work identically on PostgreSQL or Oracle.

6m read timeFrom feeds.feedblitz.com
Post cover image
Table of contents
1. Overview2. Preparing a Simple Spring Boot Example3. Demonstration5. Under The Hood6. Conclusion
5.5K Impressions1 Comment