public class BasicJdbcConverter extends BasicRelationalConverter implements JdbcConverter, ApplicationContextAware
RelationalConverter that uses a MappingContext to apply basic conversion of relational values to
property values.
Conversion is configurable by providing a customized CustomConversions.
MappingContext,
SimpleTypeHolder,
CustomConversions| Constructor and Description |
|---|
BasicJdbcConverter(MappingContext<? extends RelationalPersistentEntity<?>,? extends RelationalPersistentProperty> context,
RelationResolver relationResolver)
Creates a new
BasicRelationalConverter given MappingContext and a
no-op type factory throwing UnsupportedOperationException on type
creation. |
BasicJdbcConverter(MappingContext<? extends RelationalPersistentEntity<?>,? extends RelationalPersistentProperty> context,
RelationResolver relationResolver,
CustomConversions conversions,
JdbcTypeFactory typeFactory,
IdentifierProcessing identifierProcessing)
Creates a new
BasicRelationalConverter given MappingContext. |
| Modifier and Type | Method and Description |
|---|---|
Class<?> |
getColumnType(RelationalPersistentProperty property)
The type to be used to store this property in the database.
|
int |
getSqlType(RelationalPersistentProperty property)
The SQL type constant used when using this property as a parameter for a SQL statement.
|
<T> T |
mapRow(PersistentPropertyPathExtension path,
ResultSet resultSet,
Identifier identifier,
Object key)
|
<T> T |
mapRow(RelationalPersistentEntity<T> entity,
ResultSet resultSet,
Object key)
|
Object |
readValue(Object value,
TypeInformation<?> type) |
void |
setApplicationContext(ApplicationContext applicationContext) |
JdbcValue |
writeJdbcValue(Object value,
Class<?> columnType,
int sqlType)
Convert a property value into a
JdbcValue that contains the converted value and information how to bind it
to JDBC parameters. |
Object |
writeValue(Object value,
TypeInformation<?> type) |
createInstance, getConversions, getConversionService, getMappingContext, getPropertyAccessorclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcreateInstance, getConversionService, getMappingContext, getPropertyAccessorpublic BasicJdbcConverter(MappingContext<? extends RelationalPersistentEntity<?>,? extends RelationalPersistentProperty> context, RelationResolver relationResolver)
BasicRelationalConverter given MappingContext and a
no-op type factory throwing UnsupportedOperationException on type
creation. Use
BasicJdbcConverter(MappingContext, RelationResolver, CustomConversions, JdbcTypeFactory, IdentifierProcessing)
(MappingContext, RelationResolver, JdbcTypeFactory)} to convert arrays and large objects into JDBC-specific types.context - must not be null.relationResolver - used to fetch additional relations from the database. Must not be null.public BasicJdbcConverter(MappingContext<? extends RelationalPersistentEntity<?>,? extends RelationalPersistentProperty> context, RelationResolver relationResolver, CustomConversions conversions, JdbcTypeFactory typeFactory, IdentifierProcessing identifierProcessing)
BasicRelationalConverter given MappingContext.context - must not be null.relationResolver - used to fetch additional relations from the database. Must not be null.typeFactory - must not be nullidentifierProcessing - must not be nullpublic void setApplicationContext(ApplicationContext applicationContext)
setApplicationContext in interface ApplicationContextAwarepublic int getSqlType(RelationalPersistentProperty property)
JdbcConvertergetSqlType in interface JdbcConverternull.Typespublic Class<?> getColumnType(RelationalPersistentProperty property)
JdbcConverterString[][] returns String[]).getColumnType in interface JdbcConverterClass that is suitable for usage with JDBC drivers.JdbcUtil.sqlTypeFor(Class)@Nullable public Object readValue(@Nullable Object value, TypeInformation<?> type)
readValue in interface RelationalConverterreadValue in class BasicRelationalConverter@Nullable public Object writeValue(@Nullable Object value, TypeInformation<?> type)
writeValue in interface RelationalConverterwriteValue in class BasicRelationalConverterpublic JdbcValue writeJdbcValue(@Nullable Object value, Class<?> columnType, int sqlType)
JdbcConverterJdbcValue that contains the converted value and information how to bind it
to JDBC parameters.writeJdbcValue in interface JdbcConvertervalue - a value as it is used in the object model. May be null.columnType - TypeInformation into which the value is to be converted. Must not be null.sqlType - the type constant from Types to be used if non is specified by a converter.JdbcValue. Guaranteed to be not null.public <T> T mapRow(RelationalPersistentEntity<T> entity, ResultSet resultSet, Object key)
JdbcConvertermapRow in interface JdbcConverterentity - the persistent entity type.resultSet - the ResultSet to read from.key - primary key.public <T> T mapRow(PersistentPropertyPathExtension path, ResultSet resultSet, Identifier identifier, Object key)
JdbcConvertermapRow in interface JdbcConverterpath - path to the owning property.resultSet - the ResultSet to read from.identifier - entity identifier.key - primary key.Copyright © 2017–2021 Pivotal Software, Inc.. All rights reserved.