Mybatis中jdbcType和javaType、typeHandler的对照关系

 

 

JdbcType与Oracle、MySql数据类型对应列表,及

JdbcType Oracle MySql
CHAR CHAR CHAR
VARCHAR VARCHAR VARCHAR
LONGVARCHAR LONG VARCHAR  
CLOB CLOB TEXT
NCHAR NCHAR  
NVARCHAR    
NCLOB NCLOB  
TINYINT   TINYINT
SMALLINT SMALLINT SMALLINT
INTEGER INTEGER INTEGER
BIGINT   BIGINT
DECIMAL DECIMAL DECIMAL
DOUBLE NUMBER DOUBLE
FLOAT FLOAT FLOAT
REAL REAL REAL
NUMERIC NUMERIC/NUMBER NUMERIC
DATE DATE DATE
TIME   TIME
TIMESTAMP TIMESTAMP TIMESTAMP/DATETIME
BLOB BLOB BLOB
BIT   BIT
BOOLEAN    
CURSOR    
BINARY    
LONGVARBINARY    
VARBINARY    
ARRAY    
STRUCT    
OTHER    
UNDEFINED    
NULL    

 

TypeHandler与java类型、JDBC类型对应表

类型处理器 Java 类型 JDBC 类型
BooleanTypeHandler java.lang.Booleanboolean 数据库兼容的 BOOLEAN
ByteTypeHandler java.lang.Bytebyte 数据库兼容的 NUMERIC 或 BYTE
ShortTypeHandler java.lang.Shortshort 数据库兼容的 NUMERIC 或 SHORT INTEGER
IntegerTypeHandler java.lang.Integerint 数据库兼容的 NUMERIC 或 INTEGER
LongTypeHandler java.lang.Longlong 数据库兼容的 NUMERIC 或 LONG INTEGER
FloatTypeHandler java.lang.Floatfloat 数据库兼容的 NUMERIC 或 FLOAT
DoubleTypeHandler java.lang.Doubledouble 数据库兼容的 NUMERIC 或 DOUBLE
BigDecimalTypeHandler java.math.BigDecimal 数据库兼容的 NUMERIC 或 DECIMAL
StringTypeHandler java.lang.String CHARVARCHAR
ClobReaderTypeHandler java.io.Reader -
ClobTypeHandler java.lang.String CLOBLONGVARCHAR
NStringTypeHandler java.lang.String NVARCHARNCHAR
NClobTypeHandler java.lang.String NCLOB
BlobInputStreamTypeHandler java.io.InputStream -
ByteArrayTypeHandler byte[] 数据库兼容的字节流类型
BlobTypeHandler byte[] BLOBLONGVARBINARY
DateTypeHandler java.util.Date TIMESTAMP
DateOnlyTypeHandler java.util.Date DATE
TimeOnlyTypeHandler java.util.Date TIME
SqlTimestampTypeHandler java.sql.Timestamp TIMESTAMP
SqlDateTypeHandler java.sql.Date DATE
SqlTimeTypeHandler java.sql.Time TIME
ObjectTypeHandler Any OTHER 或未指定类型
EnumTypeHandler Enumeration Type VARCHAR-任何兼容的字符串类型,存储枚举的名称(而不是索引)
EnumOrdinalTypeHandler Enumeration Type 任何兼容的 NUMERIC 或 DOUBLE 类型,存储枚举的索引(而不是名称)。
InstantTypeHandler java.time.Instant TIMESTAMP
LocalDateTimeTypeHandler java.time.LocalDateTime TIMESTAMP
LocalDateTypeHandler java.time.LocalDate DATE
LocalTimeTypeHandler java.time.LocalTime TIME
OffsetDateTimeTypeHandler java.time.OffsetDateTime TIMESTAMP
OffsetTimeTypeHandler java.time.OffsetTime TIME
ZonedDateTimeTypeHandler java.time.ZonedDateTime TIMESTAMP
YearTypeHandler java.time.Year INTEGER
MonthTypeHandler java.time.Month INTEGER
YearMonthTypeHandler java.time.YearMonth VARCHAR or LONGVARCHAR
JapaneseDateTypeHandler java.time.chrono.JapaneseDate DATE

 

转载于:https://www.cnblogs.com/canger/p/9979606.html

你可能感兴趣的:(Mybatis中jdbcType和javaType、typeHandler的对照关系)