Java Code Examples for org.mybatis.generator.api.IntrospectedColumn#getJdbcType()

The following examples show how to use org.mybatis.generator.api.IntrospectedColumn#getJdbcType() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JavaTypeResolverDefaultImpl.java    From mybatis-generator-core-fix with Apache License 2.0 6 votes vote down vote up
public String calculateJdbcTypeName(IntrospectedColumn introspectedColumn) {
    String answer;
    JdbcTypeInformation jdbcTypeInformation = typeMap
            .get(introspectedColumn.getJdbcType());

    if (jdbcTypeInformation == null) {
        switch (introspectedColumn.getJdbcType()) {
        case Types.DECIMAL:
            answer = "DECIMAL"; //$NON-NLS-1$
            break;
        case Types.NUMERIC:
            answer = "NUMERIC"; //$NON-NLS-1$
            break;
        default:
            answer = null;
            break;
        }
    } else {
        answer = jdbcTypeInformation.getJdbcTypeName();
    }

    return answer;
}
 
Example 2
Source File: JavaTypeResolverDefaultImpl.java    From mybatis-generator-plus with Apache License 2.0 6 votes vote down vote up
public String calculateJdbcTypeName(IntrospectedColumn introspectedColumn) {
    String answer;
    JdbcTypeInformation jdbcTypeInformation = typeMap
            .get(introspectedColumn.getJdbcType());

    if (jdbcTypeInformation == null) {
        switch (introspectedColumn.getJdbcType()) {
        case Types.DECIMAL:
            answer = "DECIMAL"; //$NON-NLS-1$
            break;
        case Types.NUMERIC:
            answer = "NUMERIC"; //$NON-NLS-1$
            break;
        default:
            answer = null;
            break;
        }
    } else {
        answer = jdbcTypeInformation.getJdbcTypeName();
    }

    return answer;
}
 
Example 3
Source File: CustJavaTypeResolver.java    From mybatis-generator-plus with Apache License 2.0 6 votes vote down vote up
public String calculateJdbcTypeName(IntrospectedColumn introspectedColumn) {
    String answer;
    JdbcTypeInformation jdbcTypeInformation = typeMap.get(introspectedColumn.getJdbcType());

    switch (introspectedColumn.getJdbcType()) {
        case Types.DECIMAL:
            answer = "DECIMAL"; //$NON-NLS-1$
            break;
        case Types.NUMERIC:
            answer = "NUMERIC"; //$NON-NLS-1$
            break;
        default:
            answer = null;
            break;
    }
    if(answer==null && jdbcTypeInformation!=null){
        answer = jdbcTypeInformation.getJdbcTypeName();
    }
    return answer;
}
 
Example 4
Source File: PostgisGeoPlugin.java    From dolphin with Apache License 2.0 6 votes vote down vote up
@Override
public void initialized(IntrospectedTable introspectedTable) {
	for(IntrospectedColumn introspectedColumn : introspectedTable.getAllColumns()){
		if(introspectedColumn.getJdbcType() == Types.OTHER){
			String typeName = fetchTypeName(introspectedColumn);
			//System.out.println("postgis type : "+typeName);
			switch(typeName.toLowerCase()){
			case "geometry":{
				introspectedColumn.setFullyQualifiedJavaType(new FullyQualifiedJavaType("org.geolatte.geom.Geometry"));
				//introspectedColumn.setJdbcTypeName(typeName.toUpperCase());
				break;
			}
			}
		}
	}
}
 
Example 5
Source File: JavaTypeResolverDefaultImpl.java    From mapper-generator-javafx with Apache License 2.0 5 votes vote down vote up
protected FullyQualifiedJavaType overrideDefaultType(IntrospectedColumn column,
        FullyQualifiedJavaType defaultType) {
    FullyQualifiedJavaType answer = defaultType;

    switch (column.getJdbcType()) {
    case Types.BIT:
        answer = calculateBitReplacement(column, defaultType);
        break;
    case Types.DATE:
        answer = calculateDateType(column, defaultType);
        break;
    case Types.DECIMAL:
    case Types.NUMERIC:
        answer = calculateBigDecimalReplacement(column, defaultType);
        break;
    case Types.TIME:
        answer = calculateTimeType(column, defaultType);
        break;
    case Types.TIMESTAMP:
        answer = calculateTimestampType(column, defaultType);
        break;
    default:
        break;
    }

    return answer;
}
 
Example 6
Source File: JavaTypeResolverCalendarImpl.java    From maven-archetype with GNU Lesser General Public License v2.1 5 votes vote down vote up
public String calculateJdbcTypeName(IntrospectedColumn introspectedColumn) {
    String answer;
    JdbcTypeInformation jdbcTypeInformation = typeMap
            .get(introspectedColumn.getJdbcType());

    if (jdbcTypeInformation == null) {
        switch (introspectedColumn.getJdbcType()) {
        case Types.DECIMAL:
            answer = "DECIMAL"; //$NON-NLS-1$
            break;
        case Types.NUMERIC:
            answer = "NUMERIC"; //$NON-NLS-1$
            break;
        case Types.TIME:
            answer = "TIME"; //$NON-NLS-1$
            break;
        case Types.TIMESTAMP:
            answer = "TIMESTAMP"; //$NON-NLS-1$
            break;
        case Types.DATE:
            answer = "DATE"; //$NON-NLS-1$
            break;
        default:
            answer = null;
            break;
        }
    } else {
        answer = jdbcTypeInformation.getJdbcTypeName();
    }

    return answer;
}
 
Example 7
Source File: GenPlugin.java    From scaffold-cloud with MIT License 4 votes vote down vote up
public boolean isNumber(IntrospectedColumn introspectedColumn) {
    return introspectedColumn.getJdbcType() == Types.INTEGER || introspectedColumn.getJdbcType() == Types.NUMERIC
            || introspectedColumn.getJdbcType() == Types.BIGINT || introspectedColumn.getJdbcType() == Types.BIT
            || introspectedColumn.getJdbcType() == Types.TINYINT;
}