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

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

Introduction

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

Prototype

JdbcType BINARY

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

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;
    }// w  w w.j  a  v a  2s . co 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());
}