[JPA,Querydsl강좌]스프링에서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);
}
댓글 없음:
댓글 쓰기