Example usage for org.apache.ibatis.type JdbcType NUMERIC

List of usage examples for org.apache.ibatis.type JdbcType NUMERIC

Introduction

In this page you can find the example usage for org.apache.ibatis.type JdbcType NUMERIC.

Prototype

JdbcType NUMERIC

To view the source code for org.apache.ibatis.type JdbcType NUMERIC.

Click Source Link

Usage

From source file:org.springframework.data.mybatis.repository.support.MybatisEntityModel.java

License:Apache License

private JdbcType getJdbcType(Class<?> jt) {
    if (null == jt) {
        return JdbcType.UNDEFINED;
    }//from   ww  w . j ava  2s.c  o m
    if (jt == String.class || jt.isEnum()) {
        return JdbcType.VARCHAR;
    }
    if (jt == Long.class || jt == long.class || jt == Integer.class || jt == int.class || jt == Double.class
            || jt == double.class || jt == Float.class || jt == float.class
            || Number.class.isAssignableFrom(jt)) {
        return JdbcType.NUMERIC;
    }
    if (jt == Boolean.class || jt == boolean.class) {
        return JdbcType.BOOLEAN;
    }
    if (jt == Date.class || Date.class.isAssignableFrom(jt)) {
        return JdbcType.TIMESTAMP;
    }

    if (jt == byte[].class) {
        return JdbcType.BINARY;
    }

    throw new RuntimeException("No supported JdbcType for field :" + jt + "," + getClz());
}