Foreword: MyBatis receive a LONG type in Oracle, Error: Invalid column type: Getclob not implemented for class Oracle.jdbc.driver.T4CLongAccessor
Case
There is a long type in the Oracle table, a variable-length string is stored in a Long data type, and the maximum length limit is 2GB. (Detailed explanation can Baidu)
Since this table in the database is provided elsewhere, cannot be modified and can only be queried, the type of this field in the Oracle table cannot be modified.
So you can only handle the current problem. The current problem is as follows: Java entities use String type Iteme,mybatis SQL to use Resultmap form, SQL Resultmap as follows
<extends= "Baseresultmap" ID= "Resultmapwithblobs" type = "Com.yule.demo"> <column= "Item_e" Property= "Iteme" jdbctype= "LongVarChar"/> </ Resultmap >
Then query SQL error:
Solution Solutions
Change the LongVarChar in SQL to LongVarBinary.
<column= "Item_e" Property= "Iteme" jdbctype= " LongVarBinary "/>
Supplement (Turn
http://blog.csdn.net/loongshawn/article/details/50496460) Mybatis jdbctype with Oracle, MySQL data type corresponding list
Mybatis |
Jdbctype |
Oracle |
MYSQL |
Jdbctype |
ARRAY |
|
|
Jdbctype |
BIGINT |
|
BIGINT |
Jdbctype |
BINARY |
|
|
Jdbctype |
BIT |
|
BIT |
Jdbctype |
Blob |
Blob |
Blob |
Jdbctype |
BOOLEAN |
|
|
Jdbctype |
CHAR |
CHAR |
CHAR |
Jdbctype |
Clob |
Clob |
TEXT |
Jdbctype |
CURSOR |
|
|
Jdbctype |
DATE |
DATE |
DATE |
Jdbctype |
DECIMAL |
DECIMAL |
DECIMAL |
Jdbctype |
DOUBLE |
Number |
DOUBLE |
Jdbctype |
FLOAT |
FLOAT |
FLOAT |
Jdbctype |
INTEGER |
INTEGER |
INTEGER |
Jdbctype |
LongVarBinary |
|
|
Jdbctype |
LongVarChar |
LONG VARCHAR |
|
Jdbctype |
NCHAR |
NCHAR |
|
Jdbctype |
NCLOB |
NCLOB |
|
Jdbctype |
Null |
|
|
Jdbctype |
NUMERIC |
Numeric/number |
numeric/ |
Jdbctype |
NVARCHAR |
|
|
Jdbctype |
Other |
|
|
Jdbctype |
REAL |
REAL |
REAL |
Jdbctype |
SMALLINT |
SMALLINT |
SMALLINT |
Jdbctype |
STRUCT |
|
|
Jdbctype |
Time |
|
Time |
Jdbctype |
TIMESTAMP |
TIMESTAMP |
Timestamp/datetime |
Jdbctype |
TINYINT |
|
TINYINT |
Jdbctype |
UNDEFINED |
|
|
Jdbctype |
VARBINARY |
|
|
Jdbctype |
VARCHAR |
VARCHAR |
VARCHAR |
Note that the jdbctype part of MyBatis does not correspond to the data types of Oracle and MySQL (perhaps due to its own omission), but do not worry, follow-up people come across a detailed analysis, and the above correspondence is not necessarily one by one correspondence, please understand.
People master the basic numbers, time, string is enough to deal with the daily development.
Working experience: MyBatis processing Oracle Long type