Hibernate CASE WHEN expression not using arithmetic operation

org.hibernate.hql.internal.ast.QuerySyntaxException: unexpected token: * near line 1, column 46 [select case when p.name like ‘person%’ then 2*p.id else p.id end from com.ipinyou.mip.mdb.model.Person p]

hibernate orm 5.3.7

select 
    case when p.name like ‘person%’ 
    then 2*p.id 
    else p.id end 
from com.ipinyou.mip.mdb.model.Person p

I created HHH-13095 for it and submitted a PR for updating the docs.

You need to use parenthesis to wrap the arithmetic expression:

select 
    case when p.name like ‘person%’ 
    then (2*p.id) 
    else p.id end 
from com.ipinyou.mip.mdb.model.Person p