Mybatis中javaType和jdbcType对应和CRUD例子

MybatisjavaTypejdbcType对应和CRUD例子
Xml代码 复制代码 
  1. <resultMap type="java.util.Map" id="resultjcm">  
  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="[B" 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>  
<resultMap type="java.util.Map" id="resultjcm">
  <result property="FLD_NUMBER" column="FLD_NUMBER"  javaType="double" jdbcType="NUMERIC"/>
  <result property="FLD_VARCHAR" column="FLD_VARCHAR" javaType="string" jdbcType="VARCHAR"/>
  <result property="FLD_DATE" column="FLD_DATE" javaType="java.sql.Date" jdbcType="DATE"/>
  <result property="FLD_INTEGER" column="FLD_INTEGER"  javaType="int" jdbcType="INTEGER"/>
  <result property="FLD_DOUBLE" column="FLD_DOUBLE"  javaType="double" jdbcType="DOUBLE"/>
  <result property="FLD_LONG" column="FLD_LONG"  javaType="long" jdbcType="INTEGER"/>
  <result property="FLD_CHAR" column="FLD_CHAR"  javaType="string" jdbcType="CHAR"/>
  <result property="FLD_BLOB" column="FLD_BLOB"  javaType="[B" jdbcType="BLOB" />
  <result property="FLD_CLOB" column="FLD_CLOB"  javaType="string" jdbcType="CLOB"/>
  <result property="FLD_FLOAT" column="FLD_FLOAT"  javaType="float" jdbcType="FLOAT"/>
  <result property="FLD_TIMESTAMP" column="FLD_TIMESTAMP"  javaType="java.sql.Timestamp" jdbcType="TIMESTAMP"/>
 </resultMap>

 

 

MybatisjavaTypejdbcType对应关系

 

Notepad代码 复制代码 
  1. JDBC Type           Java Type  
  2. CHAR                String  
  3. VARCHAR             String  
  4. LONGVARCHAR         String  
  5. NUMERIC             java.math.BigDecimal  
  6. DECIMAL             java.math.BigDecimal  
  7. BIT             boolean  
  8. BOOLEAN             boolean  
  9. TINYINT             byte  
  10. SMALLINT            short  
  11. INTEGER             int  
  12. BIGINT              long  
  13. REAL                float  
  14. FLOAT               double  
  15. DOUBLE              double  
  16. BINARY              byte[]  
  17. VARBINARY           byte[]  
  18. LONGVARBINARY               byte[]  
  19. DATE                java.sql.Date  
  20. TIME                java.sql.Time  
  21. TIMESTAMP           java.sql.Timestamp  
  22. CLOB                Clob  
  23. BLOB                Blob  
  24. ARRAY               Array  
  25. DISTINCT            mapping of underlying type  
  26. STRUCT              Struct  
  27. REF                         Ref  
  28. DATALINK            java.net.URL[color=red][/color]  

你可能感兴趣的:(Mybatis中javaType和jdbcType对应和CRUD例子)