mybatis中的jdbcType配置

1. 可以配置的jdbcType类型

 

BIT         FLOAT      CHAR           TIMESTAMP       OTHER       UNDEFINED

TINYINT     REAL       VARCHAR        BINARY          BLOB        NVARCHAR

SMALLINT    DOUBLE     LONGVARCHAR    VARBINARY       CLOB        NCHAR

INTEGER     NUMERIC    DATE           LONGVARBINARY   BOOLEAN     NCLOB

BIGINT      DECIMAL    TIME           NULL            CURSOR      ARRAY

 

其中常用的jdbcType如下:CHAR、VARCHAR、INTEGER、NUMERIC、DECIMAL、DATE、TIMESTAMP

 

2.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

 

3. 示例

 

 

  	<resultMap id="memberMap" type="com.test.pojo.Member"> 
    	<result column="USERNAME" jdbcType="VARCHAR" property="userName" />
  	</resultMap>

 

你可能感兴趣的:(java,mybatis,orm,配置,jdbcType)