package fi.csc.antero.config;

import com.querydsl.sql.H2Templates;
import com.querydsl.sql.SQLQueryFactory;
import com.querydsl.sql.SQLServer2012Templates;
import com.querydsl.sql.SQLTemplates;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;

import javax.sql.DataSource;

@Configuration
public class AppConfig {

    @Bean
    @Profile({"dev", "default"})
    public SQLQueryFactory getH2QueryFactory(@Qualifier("dataSource") @Autowired DataSource dataSource) {
        return getSqlQueryFactory(dataSource, new H2Templates());
    }

    @Bean
    @Profile("prod")
    public SQLQueryFactory getMSSQLQueryFactory(@Qualifier("dataSource") @Autowired DataSource dataSource) {
        return getSqlQueryFactory(dataSource, new SQLServer2012Templates());
    }

    private SQLQueryFactory getSqlQueryFactory(@Qualifier("dataSource") @Autowired DataSource dataSource, SQLTemplates templates) {
        final com.querydsl.sql.Configuration configuration = new com.querydsl.sql.Configuration(templates);
        return new SQLQueryFactory(configuration, dataSource);
    }
}

@@ -130,33 +130,33 @@
 sql.SQLServer201
-2
+6
 Templates;%0Aimpor
@@ -978,17 +978,17 @@
 erver201
-2
+6
 Template

Update AppConfig.java