Search in sources :

Example 1 with JdbcRepositoryFactory

use of org.springframework.data.jdbc.repository.support.JdbcRepositoryFactory in project spring-data-jdbc by spring-projects.

the class SimpleJdbcRepositoryEventsUnitTests method before.

@Before
public void before() {
    final JdbcMappingContext context = new JdbcMappingContext(createIdGeneratingOperations());
    JdbcRepositoryFactory factory = new // 
    JdbcRepositoryFactory(// 
    publisher, // 
    context, new // 
    DefaultDataAccessStrategy(// 
    new SqlGeneratorSource(context), // 
    context));
    repository = factory.getRepository(DummyEntityRepository.class);
}
Also used : JdbcMappingContext(org.springframework.data.jdbc.mapping.model.JdbcMappingContext) SqlGeneratorSource(org.springframework.data.jdbc.core.SqlGeneratorSource) JdbcRepositoryFactory(org.springframework.data.jdbc.repository.support.JdbcRepositoryFactory) Before(org.junit.Before)

Example 2 with JdbcRepositoryFactory

use of org.springframework.data.jdbc.repository.support.JdbcRepositoryFactory in project spring-data-jdbc by spring-projects.

the class TestConfiguration method jdbcRepositoryFactory.

@Bean
JdbcRepositoryFactory jdbcRepositoryFactory(DataAccessStrategy dataAccessStrategy) {
    NamedParameterJdbcOperations jdbcTemplate = namedParameterJdbcTemplate();
    final JdbcMappingContext context = new JdbcMappingContext(NamingStrategy.INSTANCE, jdbcTemplate, __ -> {
    });
    return new // 
    JdbcRepositoryFactory(// 
    publisher, // 
    context, // 
    dataAccessStrategy);
}
Also used : JdbcMappingContext(org.springframework.data.jdbc.mapping.model.JdbcMappingContext) JdbcRepositoryFactory(org.springframework.data.jdbc.repository.support.JdbcRepositoryFactory) NamedParameterJdbcOperations(org.springframework.jdbc.core.namedparam.NamedParameterJdbcOperations) Bean(org.springframework.context.annotation.Bean)

Aggregations

JdbcMappingContext (org.springframework.data.jdbc.mapping.model.JdbcMappingContext)2 JdbcRepositoryFactory (org.springframework.data.jdbc.repository.support.JdbcRepositoryFactory)2 Before (org.junit.Before)1 Bean (org.springframework.context.annotation.Bean)1 SqlGeneratorSource (org.springframework.data.jdbc.core.SqlGeneratorSource)1 NamedParameterJdbcOperations (org.springframework.jdbc.core.namedparam.NamedParameterJdbcOperations)1