Hope someone can help me with this HQL query.
I'm using:
Query query = session.createQuery(sql);
where the sql is:
select distinct c.id from EstateConsumer as c where c.clientId = ? and (c.vehicleReg1 or c.vehicleReg2) like ?
but is getting the following exception:
org.hibernate.hql.ast.QuerySyntaxException: unexpected AST node: or near line 1, column 121
So how can you use the "OR" syntax by using one "like"?
The following however works:
select distinct c.id from EstateConsumer as c where c.clientId = ? and c.vehicleReg1 like ? or c.vehicleReg2 like ?
but I don't want to use multiple "like"'s