zoukankan      html  css  js  c++  java
  • Mybatis 内置 Java 类型别名与 typeHandlers

    aliases

    There are many built-in type aliases for common Java types. They are all case insensitive, note the special handling of primitives due to the overloaded names.

    AliasMapped Type
    _byte byte
    _long long
    _short short
    _int int
    _integer int
    _double double
    _float float
    _boolean boolean
    string String
    byte Byte
    long Long
    short Short
    int Integer
    integer Integer
    double Double
    float Float
    boolean Boolean
    date Date
    decimal BigDecimal
    bigdecimal BigDecimal
    object Object
    map Map
    hashmap HashMap
    list List
    arraylist ArrayList
    collection Collection
    iterator Iterator

    typeHandlers

    Whenever MyBatis sets a parameter on a PreparedStatement or retrieves a value from a ResultSet, a TypeHandler is used to retrieve the value in a means appropriate to the Java type. The following table describes the default TypeHandlers.

    NOTE If you use classes provided by JSR-310(Date and Time API), you can use the mybatis-typehandlers-jsr310.

    Type HandlerJava TypesJDBC Types
    BooleanTypeHandler java.lang.Boolean, boolean Any compatible BOOLEAN
    ByteTypeHandler java.lang.Byte, byte Any compatible NUMERIC or BYTE
    ShortTypeHandler java.lang.Short, short Any compatible NUMERIC or SHORT INTEGER
    IntegerTypeHandler java.lang.Integer, int Any compatible NUMERIC or INTEGER
    LongTypeHandler java.lang.Long, long Any compatible NUMERIC or LONG INTEGER
    FloatTypeHandler java.lang.Float, float Any compatible NUMERIC or FLOAT
    DoubleTypeHandler java.lang.Double, double Any compatible NUMERIC or DOUBLE
    BigDecimalTypeHandler java.math.BigDecimal Any compatible NUMERIC or DECIMAL
    StringTypeHandler java.lang.String CHAR, VARCHAR
    ClobReaderTypeHandler java.io.Reader -
    ClobTypeHandler java.lang.String CLOB, LONGVARCHAR
    NStringTypeHandler java.lang.String NVARCHAR, NCHAR
    NClobTypeHandler java.lang.String NCLOB
    BlobInputStreamTypeHandler java.io.InputStream -
    ByteArrayTypeHandler byte[] Any compatible byte stream type
    BlobTypeHandler byte[] BLOB, LONGVARBINARY
    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, or unspecified
    EnumTypeHandler Enumeration Type VARCHAR any string compatible type, as the code is stored (not index).
    EnumOrdinalTypeHandler Enumeration Type Any compatible NUMERIC or DOUBLE, as the position is stored (not the code itself).

    本来转载:http://blog.csdn.net/wz5891/article/details/52730735

  • 相关阅读:
    Windows API 第六篇 GetLocalTime
    _itoa _itow _itot atoi atof atol
    Window API 第五篇 WTSEnumerateProcesses
    获取计算机以及本机信息API
    Windows API 第四篇 文件操作
    [软工顶级理解组] 团队介绍和采访!
    2019 SDN上机第1次作业
    第01组 团队项目-需求分析报告
    团队项目-选题报告
    第二次结对编程作业
  • 原文地址:https://www.cnblogs.com/cainiao-Shun666/p/7909675.html
Copyright © 2011-2022 走看看