Does Eclipselink support regular expression queries?

I've seen that a DBMS like MySQL supports a query containing regular expressions. Does Eclipselink support this?

I need to get objects having some String attribute matching some regex like

SELECT X FROM Person X WHERE <some keyword> (A-Z)*



source to share

1 answer

MySQL uses REGEX or RLIKE for regular expression queries. JPQL does not support these operators, so you can use your own SQL query.

In EclipseLink, you can define your own ExpressionOperator and use it in your Expression query, but not currently with JPQL. JPQL supports functions to call the database using FUNC, but they have a different syntax than functions. You can extend MySQLPlatform to do # like us REGEX or RLIKE.

Please file a bug for this on EclipseLink. Most databases now support regex, so this support should be available in JPQL.



All Articles