@FunctionalInterface public interface TypeMapper
The mapping defined by an instance of this class will be applied
globally to all in and out parameter of all methods in an interface.
If you want to customize only a single parameter use
ParameterType, OutParameter.type() or
ReturnValue.type() instead.
If no custom implementation is specified the following default are used:
| Java Type | SQL type |
|---|---|
| String | Types.VARCHAR |
| char is not mapped | |
| limited precision integers | |
| Integer | Types.INTEGER |
| int | Types.INTEGER |
| Long | Types.BIGINT |
| long | Types.BIGINT |
| Short | Types.SMALLINT |
| short | Types.SMALLINT |
| Byte | Types.TINYINT |
| byte | Types.TINYINT |
| arbitrary precision numbers | |
| should be an alias for DECIMAL but Oracle treats DECIMAL as double | |
| BigDecimal | Types.NUMERIC |
| BigInteger | Types.NUMERIC |
| floating points | |
| Float | Types.REAL |
| Double | Types.DOUBLE |
| float | Types.REAL |
| double | Types.DOUBLE |
| LOBs | |
| Blob | Types.BLOB |
| Clob | Types.CLOB |
| NClob | Types.NCLOB |
| java 8 date time | |
| LocalDate | Types.DATE |
| LocalTime | Types.TIME |
| LocalDateTime | Types.TIMESTAMP |
| OffsetTime | Types.TIME_WITH_TIMEZONE |
| OffsetDateTime | Types.TIMESTAMP_WITH_TIMEZONE |
| old date time | |
| java.sql.Date | Types.DATE |
| java.sql.Time | Types.TIME |
| java.sql.Timestamp | Types.TIMESTAMP |
| XML | |
| SQLXML | Types.SQLXML |
| boolean | |
| Boolean | Types.BOOLEAN |
| boolean | Types.BOOLEAN |
| ARRAY | |
| Collection | Types.ARRAY |
| List | Types.ARRAY |
| Set | Types.ARRAY |
| array | Types.ARRAY |
| Modifier and Type | Method and Description |
|---|---|
int |
mapToSqlType(Class<?> javaType)
Maps a Java type to a SQL type.
|
Copyright © 2013–2016. All rights reserved.