Search in sources :

Example 6 with BasicJdbcConverter

use of org.springframework.data.jdbc.core.convert.BasicJdbcConverter in project spring-data-jdbc by spring-projects.

the class AbstractJdbcConfiguration method jdbcConverter.

/**
 * Creates a {@link RelationalConverter} using the configured
 * {@link #jdbcMappingContext(Optional, JdbcCustomConversions)}. Will get {@link #jdbcCustomConversions()} ()}
 * applied.
 *
 * @see #jdbcMappingContext(Optional, JdbcCustomConversions)
 * @see #jdbcCustomConversions()
 * @return must not be {@literal null}.
 */
@Bean
public JdbcConverter jdbcConverter(JdbcMappingContext mappingContext, NamedParameterJdbcOperations operations, @Lazy RelationResolver relationResolver, JdbcCustomConversions conversions, Dialect dialect) {
    JdbcArrayColumns arrayColumns = dialect instanceof JdbcDialect ? ((JdbcDialect) dialect).getArraySupport() : JdbcArrayColumns.DefaultSupport.INSTANCE;
    DefaultJdbcTypeFactory jdbcTypeFactory = new DefaultJdbcTypeFactory(operations.getJdbcOperations(), arrayColumns);
    return new BasicJdbcConverter(mappingContext, relationResolver, conversions, jdbcTypeFactory, dialect.getIdentifierProcessing());
}
Also used : BasicJdbcConverter(org.springframework.data.jdbc.core.convert.BasicJdbcConverter) JdbcArrayColumns(org.springframework.data.jdbc.core.dialect.JdbcArrayColumns) DefaultJdbcTypeFactory(org.springframework.data.jdbc.core.convert.DefaultJdbcTypeFactory) JdbcDialect(org.springframework.data.jdbc.core.dialect.JdbcDialect) Bean(org.springframework.context.annotation.Bean)

Aggregations

BasicJdbcConverter (org.springframework.data.jdbc.core.convert.BasicJdbcConverter)6 BeforeEach (org.junit.jupiter.api.BeforeEach)3 RelationalMappingContext (org.springframework.data.relational.core.mapping.RelationalMappingContext)3 Test (org.junit.jupiter.api.Test)2 DefaultJdbcTypeFactory (org.springframework.data.jdbc.core.convert.DefaultJdbcTypeFactory)2 JdbcConverter (org.springframework.data.jdbc.core.convert.JdbcConverter)2 NamedParameterJdbcOperations (org.springframework.jdbc.core.namedparam.NamedParameterJdbcOperations)2 Bean (org.springframework.context.annotation.Bean)1 DefaultDataAccessStrategy (org.springframework.data.jdbc.core.convert.DefaultDataAccessStrategy)1 DelegatingDataAccessStrategy (org.springframework.data.jdbc.core.convert.DelegatingDataAccessStrategy)1 JdbcCustomConversions (org.springframework.data.jdbc.core.convert.JdbcCustomConversions)1 SqlGeneratorSource (org.springframework.data.jdbc.core.convert.SqlGeneratorSource)1 JdbcArrayColumns (org.springframework.data.jdbc.core.dialect.JdbcArrayColumns)1 JdbcDialect (org.springframework.data.jdbc.core.dialect.JdbcDialect)1 JdbcMappingContext (org.springframework.data.jdbc.core.mapping.JdbcMappingContext)1 JdbcRepositoryFactory (org.springframework.data.jdbc.repository.support.JdbcRepositoryFactory)1 Dialect (org.springframework.data.relational.core.dialect.Dialect)1 H2Dialect (org.springframework.data.relational.core.dialect.H2Dialect)1 HsqlDbDialect (org.springframework.data.relational.core.dialect.HsqlDbDialect)1 RowMapper (org.springframework.jdbc.core.RowMapper)1