I want to achieve the effect of following query in Hibernate, but I'm unable to figure out a way to do this.
select e.TITLE from EVENTS e where e.TITLE REGEXP 'fri|pro';
Can someone help?
Hibernate QL doesn't support regular expressions (and some engines have a very poor regexes support). You can transform your query to be
select e.TITLE from EVENTS e where (e.TITLE = 'fri' OR e.TITLE = 'pro');
or
select e.TITLE from EVENTS e where e.TITLE in ('fri','pro');
But for real regex support you'll have to write custom SQL (if your DB does support regexes at all)
select e.TITLE from EVENTS e where e.TITLE like 'fri%pro' OR e.TITLE like '%fri%' OR e.TITLE like '%pro%' Pick what "like" you like more :-) i.e. which one meets your conditions since they are still unclear.