简体   繁体   中英

Is there any way to convert a sql query into hql query with REGEXP

Is there any way to convert the SQL query with REGEXP to HQL query fro this example.

SELECT * FROM product m WHERE id = 19 and m.name REGEXP ('DEf|abc');

SELECT * FROM product m WHERE id = 19 and m.name REGEXP ('DEf|abc');

where name is column having json values

I expect the output will display the results but i am getting an error

UNEXPECTED TOKEN REGEXP.

HQL does not have regular expressions.

but for this you could use a like or

    SELECT * FROM product m 
    WHERE id = 19 
    and ( m.name like '%Def%' or m.name like '%abc%' );

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM