Reputation: 11
I have a hql request where I have to filter rows by parameter value from list. I pass parameters to request and everything works fine till one of parameters not contains parentheses. If parameter = 'Windows' everything ok, but if 'macOS 10.13 (High Sierra)' it not founds proper rows.
select agent where agent.operatingSystem in (:p1,:p2)
I found that if rows with filtering value without parentheses exist - it query founds them: this query return agents with os = "macOS 10.13 High Sierra" but not found "macOS 10.13 (High Sierra)"
Upvotes: 1
Views: 363
Reputation: 86
You can do something like this. Prepare you list of Operating Systems and pass it as list to your "in clause".
Query query = session.createQuery("FROM YourTable t WHERE t.os IN (:osIds)");
query.setParameterList("osIds", listOfOs);
Upvotes: 1