public Class < ? > getJavaType ( int sqlType , String typeName , int size , int digits , String tableName , String columnName ) { // table.column mapped class Type < ? > type = javaTypeMapping . getType ( tableName , columnName ) ; if ( type != null ) { return type . getReturnedClass ( ) ; } else if ( typeName != null && ! typeName . isEmpty ( ) ) { typeName = typeName . toLowerCase ( ) ; // typename mapped class Class < ? > clazz = typeToName . get ( typeName ) ; if ( clazz != null ) { return clazz ; } if ( sqlType == Types . ARRAY ) { if ( typeName . startsWith ( "_" ) ) { typeName = typeName . substring ( 1 ) ; } else if ( typeName . endsWith ( " array" ) ) { typeName = typeName . substring ( 0 , typeName . length ( ) - 6 ) ; } if ( typeName . contains ( "[" ) ) { typeName = typeName . substring ( 0 , typeName . indexOf ( "[" ) ) ; } if ( typeName . contains ( "(" ) ) { typeName = typeName . substring ( 0 , typeName . indexOf ( "(" ) ) ; } Integer sqlComponentType = templates . getCodeForTypeName ( typeName ) ; if ( sqlComponentType == null ) { logger . warn ( "Found no JDBC type for " + typeName + " using OTHER instead" ) ; sqlComponentType = Types . OTHER ; } Class < ? > componentType = jdbcTypeMapping . get ( sqlComponentType , size , digits ) ; return Array . newInstance ( componentType , 0 ) . getClass ( ) ; } } // sql type mapped class return jdbcTypeMapping . get ( sqlType , size , digits ) ; }
Get the java type for the given jdbc type table name and column name