Assuming we have a query like this one where the end parenthesis does not have a matching start parenthesis:
session.createQuery(
"select a from Product a " +
"where " +
"coalesce(a.description, :description) = :description)", Product.class)
.setParameter( "description", "desc" )
.getResultList();
The end parenthesis is discarded instead of throwing an exception:
select
product0_.productId as productI1_35_,
product0_.description as descript2_35_,
product0_.cost as cost3_35_,
product0_.numberAvailable as numberAv4_35_
from
Product product0_
where
coalesce(product0_.description, ?)=?