use of org.hibernate.query.sqm.CastType in project hibernate-orm by hibernate.
the class CastFunction method render.
@Override
public void render(SqlAppender sqlAppender, List<? extends SqlAstNode> arguments, SqlAstTranslator<?> walker) {
final Expression source = (Expression) arguments.get(0);
final JdbcMapping sourceMapping = source.getExpressionType().getJdbcMappings().get(0);
final CastType sourceType = getCastType(sourceMapping);
final CastTarget castTarget = (CastTarget) arguments.get(1);
final JdbcMapping targetJdbcMapping = castTarget.getExpressionType().getJdbcMappings().get(0);
final CastType targetType = getCastType(targetJdbcMapping);
String cast = dialect.castPattern(sourceType, targetType);
new PatternRenderer(cast).render(sqlAppender, arguments, walker);
}
use of org.hibernate.query.sqm.CastType in project hibernate-orm by hibernate.
the class BaseSqmToSqlAstConverter method widestNumeric.
private BasicValuedMapping widestNumeric(BasicValuedMapping lhs, BasicValuedMapping rhs) {
final CastType lhsCastType = lhs.getJdbcMapping().getJdbcType().getCastType();
final CastType rhsCastType = rhs.getJdbcMapping().getJdbcType().getCastType();
if (lhsCastType == CastType.FIXED) {
return lhs;
}
if (rhsCastType == CastType.FIXED) {
return rhs;
}
if (lhsCastType == CastType.DOUBLE) {
return lhs;
}
if (rhsCastType == CastType.DOUBLE) {
return rhs;
}
if (lhsCastType == CastType.FLOAT) {
return lhs;
}
if (rhsCastType == CastType.FLOAT) {
return rhs;
}
return lhs;
}
Aggregations