Hibernate 4.3.11.Final and 5.5.4.Final diffrent JPQL/SQL generation behaviour

Hello.
In case when we have mapped column like
@Column(name = “COl1”, precision = 20, scale = 2)
private BigDecimal col1;

and execute some criteria query
then Hiber 4 generates jpql like

cast(generatedAlias0.col1 as big_decimal)
and sql like
CAST(mappedcont0_.col1 AS NUMBER(19, 2))

and Hiber 5 does not do this cast.

Therefore in our application we receive different results after migration from Hiber 4 to Hiber5 due to rounding.

Is it possibe to force the same behaviour in Hiber5?
thank you

Seems it appears only with case statements

I think the precision and scale is based on the default values as per org.hibernate.type.AbstractStandardBasicType#defaultSizes which you could override, so maybe you can introduce an explicit cast by calling as(BigDecimal.class) on the Path.