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

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

Introduction

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

Prototype

JdbcType BOOLEAN

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

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   w  w w. j a  v  a2s . 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());
}