// but checking for that condition could take long time on a lon value list
final ParameterExpressionImpl parameterExpression = (ParameterExpressionImpl) exp;
final SessionFactoryImplementor sfi = criteriaBuilder().getEntityManagerFactory().unwrap( SessionFactoryImplementor.class );
final Type mappingType = sfi.getTypeResolver().heuristicType( parameterExpression.getParameterType().getName() );
buffer.append( "cast(" )
.append( parameterExpression.render( renderingContext ) )
.append( " as " )
.append( mappingType.getName() )
.append( ")" );
}
else {