use of org.hibernate.query.sqm.tree.expression.SqmCastTarget in project hibernate-orm by hibernate.
the class SemanticQueryBuilder method visitCastTarget.
@Override
public SqmCastTarget<?> visitCastTarget(HqlParser.CastTargetContext castTargetContext) {
final HqlParser.CastTargetTypeContext castTargetTypeContext = (HqlParser.CastTargetTypeContext) castTargetContext.getChild(0);
final String targetName = castTargetTypeContext.fullTargetName;
Long length = null;
Integer precision = null;
Integer scale = null;
switch(castTargetTypeContext.getChildCount()) {
case 6:
scale = Integer.valueOf(castTargetTypeContext.getChild(4).getText());
case 4:
length = Long.valueOf(castTargetTypeContext.getChild(2).getText());
precision = length.intValue();
break;
}
return new SqmCastTarget<>((ReturnableType<?>) creationContext.getJpaMetamodel().getTypeConfiguration().resolveCastTargetType(targetName), // TODO: is there some way to interpret as length vs precision/scale here at this point?
length, precision, scale, creationContext.getNodeBuilder());
}
Aggregations