2016년 3월 2일 수요일

[Spring Data JPA]Querydsl,SQLQueryFactory스프링코드

        @Autowired
DataSource dataSource;

@Transactional()
public void run(String... args) {
/////////
}

public PlatformTransactionManager transactionManager() {
return new DataSourceTransactionManager(dataSource);
}

public Configuration querydslConfiguration() {
SQLTemplates templates = MySQLTemplates.builder().build();
Configuration configuration = new Configuration(templates);
configuration.setExceptionTranslator(new SpringExceptionTranslator());
return configuration;
}

public SQLQueryFactory queryFactory() {
Provider<Connection> provider = new SpringConnectionProvider(dataSource);
return new SQLQueryFactory(querydslConfiguration(), provider);

댓글 없음:

댓글 쓰기