public static String convertType(Column column) { Class<?> clas = column.getJavaType(); String typeName = TypeFacility.getDataTypeName(clas); return convertType(typeName); }
@Override public List<?> translate(Function function) { if (function.getType() == TypeFacility.RUNTIME_TYPES.INTEGER || function.getType() == TypeFacility.RUNTIME_TYPES.LONG) { Function result = ConvertModifier.createConvertFunction(getLanguageFactory(), function, TypeFacility.getDataTypeName(function.getType())); function.setType(TypeFacility.RUNTIME_TYPES.BIG_DECIMAL); return Arrays.asList(result); } return null; } });
private void addCast(String nativeType, DerivedColumn dc) { if (nativeType != null) { Function cast = ConvertModifier.createConvertFunction(getLanguageFactory(), dc.getExpression(), nativeType); cast.setName("cast"); //$NON-NLS-1$ dc.setExpression(cast); } else { dc.setExpression(ConvertModifier.createConvertFunction(getLanguageFactory(), dc.getExpression(), TypeFacility.getDataTypeName(dc.getExpression().getType()))); } }
if (entity.getIdType().getPersistenceType().equals(PersistenceType.BASIC)) { SingularAttribute<?, ?> pkattr = entity.getId(entity.getIdType().getJavaType()); addColumn(mf, pkattr.getName(), TypeFacility.getDataTypeName(getJavaDataType(pkattr.getJavaType())), entityTable); mf.addPrimaryKey("PK_"+entity.getName(), Arrays.asList(pkattr.getName()), entityTable); //$NON-NLS-1$ for (Object obj:entity.getIdClassAttributes()) { SingularAttribute<?, ?> attr = (SingularAttribute)obj; addColumn(mf, attr.getName(), TypeFacility.getDataTypeName(getJavaDataType(attr.getJavaType())), entityTable); keys.add(attr.getName());
if (simpleType) { Column column = addColumn(mf, String.join("_", attrPath), TypeFacility.getDataTypeName(getJavaDataType(attr.getJavaType())), entityTable); if (((SingularAttribute)attr).isOptional()) { column.setDefaultValue(null);
@Override public List<?> translate(LanguageObject obj, ExecutionContext context) { //DB2 doesn't support cross join convertCrossJoinToInner(obj, getLanguageFactory()); //DB2 needs projected nulls wrapped in casts if (obj instanceof DerivedColumn) { DerivedColumn selectSymbol = (DerivedColumn)obj; if (selectSymbol.getExpression() instanceof Literal) { Literal literal = (Literal)selectSymbol.getExpression(); if (literal.getValue() == null) { String type = TypeFacility.RUNTIME_NAMES.INTEGER; if (literal.getType() != TypeFacility.RUNTIME_TYPES.NULL) { type = TypeFacility.getDataTypeName(literal.getType()); } selectSymbol.setExpression(ConvertModifier.createConvertFunction(getLanguageFactory(), literal, type)); } } } return super.translate(obj, context); }