use of org.springframework.data.jdbc.core.convert.DefaultJdbcTypeFactory in project spring-data-jdbc by spring-projects.
the class SimpleJdbcRepositoryEventsUnitTests method before.
@BeforeEach
public void before() {
RelationalMappingContext context = new JdbcMappingContext();
NamedParameterJdbcOperations operations = createIdGeneratingOperations();
DelegatingDataAccessStrategy delegatingDataAccessStrategy = new DelegatingDataAccessStrategy();
Dialect dialect = HsqlDbDialect.INSTANCE;
JdbcConverter converter = new BasicJdbcConverter(context, delegatingDataAccessStrategy, new JdbcCustomConversions(), new DefaultJdbcTypeFactory(operations.getJdbcOperations()), dialect.getIdentifierProcessing());
SqlGeneratorSource generatorSource = new SqlGeneratorSource(context, converter, dialect);
this.dataAccessStrategy = spy(new DefaultDataAccessStrategy(generatorSource, context, converter, operations));
delegatingDataAccessStrategy.setDelegate(dataAccessStrategy);
doReturn(true).when(dataAccessStrategy).update(any(), any());
JdbcRepositoryFactory factory = new JdbcRepositoryFactory(dataAccessStrategy, context, converter, H2Dialect.INSTANCE, publisher, operations);
this.repository = factory.getRepository(DummyEntityRepository.class);
}
use of org.springframework.data.jdbc.core.convert.DefaultJdbcTypeFactory 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());
}
Aggregations