MyBatis配置Mapping,JavaType和JDBCType的对应关系
Posted 水木山川
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了MyBatis配置Mapping,JavaType和JDBCType的对应关系相关的知识,希望对你有一定的参考价值。
Mybatis中javaType和jdbcType对应关系:
JDBC Type Java Type
CHAR String
VARCHAR String
LONGVARCHAR String
NUMERIC java.math.BigDecimal
DECIMAL java.math.BigDecimal
BIT boolean
BOOLEAN boolean
TINYINT byte
SMALLINT short
INTEGER int
BIGINT long
REAL float
FLOAT double
DOUBLE double
BINARY byte[]
VARBINARY byte[]
LONGVARBINARY byte[]
DATE java.sql.Date
TIME java.sql.Time
TIMESTAMP java.sql.Timestamp
CLOB Clob
BLOB Blob
ARRAY Array
DISTINCT mapping of underlying type
STRUCT Struct
REF Ref
DATALINK java.net.URL[color=red][/color]
样例:
1 <resultMap type="java.util.Map" id="resultData"> 2 <result property="FLD_NUMBER" column="FLD_NUMBER" javaType="double" jdbcType="NUMERIC"/> 3 <result property="FLD_VARCHAR" column="FLD_VARCHAR" javaType="string" jdbcType="VARCHAR"/> 4 <result property="FLD_DATE" column="FLD_DATE" javaType="java.sql.Date" jdbcType="DATE"/> 5 <result property="FLD_INTEGER" column="FLD_INTEGER" javaType="int" jdbcType="INTEGER"/> 6 <result property="FLD_DOUBLE" column="FLD_DOUBLE" javaType="double" jdbcType="DOUBLE"/> 7 <result property="FLD_LONG" column="FLD_LONG" javaType="long" jdbcType="INTEGER"/> 8 <result property="FLD_CHAR" column="FLD_CHAR" javaType="string" jdbcType="CHAR"/> 9 <result property="FLD_BLOB" column="FLD_BLOB" javaType="Blob" jdbcType="BLOB" /> 10 <result property="FLD_CLOB" column="FLD_CLOB" javaType="string" jdbcType="CLOB"/> 11 <result property="FLD_FLOAT" column="FLD_FLOAT" javaType="float" jdbcType="FLOAT"/> 12 <result property="FLD_TIMESTAMP" column="FLD_TIMESTAMP" javaType="java.sql.Timestamp" jdbcType="TIMESTAMP"/> 13 </resultMap>
以上是关于MyBatis配置Mapping,JavaType和JDBCType的对应关系的主要内容,如果未能解决你的问题,请参考以下文章
完美解决Could not process result for mapping: ResultMapping{property=‘null‘, column=‘xxx‘, javaType=
完美解决Could not process result for mapping: ResultMapping{property=‘null‘, column=‘xxx‘, javaType=
完美解决Could not process result for mapping: ResultMapping{property=‘null‘, column=‘xxx‘, javaType=
mybatis javaType 和 jdbcType 区别