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 X.name <some keyword> (A-Z)*

      

+2


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.

+5


source







All Articles