@@ -0,0 +1,2454 @@
+package com.epam.ta.reportportal.config;%0A%0Aimport org.jooq.SQLDialect;%0Aimport org.jooq.impl.DataSourceConnectionProvider;%0Aimport org.jooq.impl.DefaultConfiguration;%0Aimport org.jooq.impl.DefaultDSLContext;%0Aimport org.springframework.beans.factory.annotation.Autowired;%0Aimport org.springframework.boot.autoconfigure.jdbc.DataSourceProperties;%0Aimport org.springframework.boot.context.properties.EnableConfigurationProperties;%0Aimport org.springframework.context.annotation.Bean;%0Aimport org.springframework.context.annotation.Configuration;%0Aimport org.springframework.jdbc.datasource.DataSourceTransactionManager;%0Aimport org.springframework.jdbc.datasource.TransactionAwareDataSourceProxy;%0Aimport org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;%0Aimport org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter;%0A%0Aimport javax.persistence.EntityManagerFactory;%0Aimport javax.sql.DataSource;%0A%0A/**%0A * @author Pavel Bortnik%0A */%0A@Configuration%0A@EnableConfigurationProperties%0Apublic class DatabaseConfiguration %7B%0A%0A%09@Autowired%0A%09private DataSourceProperties properties;%0A%0A%09@Bean%0A%09public DataSource dataSource() %7B%0A%09%09return properties.initializeDataSourceBuilder().build();%0A%09%7D%0A%0A%09@Bean%0A%09public EntityManagerFactory entityManagerFactory() %7B%0A%0A%09%09HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();%0A%09%09vendorAdapter.setGenerateDdl(true);%0A%0A%09%09LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean();%0A%09%09factory.setJpaVendorAdapter(vendorAdapter);%0A%09%09factory.setPackagesToScan(%22com.epam.ta.reportportal.jooq.pojos%22);%0A%09%09factory.setDataSource(dataSource());%0A%09%09factory.afterPropertiesSet();%0A%0A%09%09return factory.getObject();%0A%09%7D%0A%0A%09@Bean%0A%09public TransactionAwareDataSourceProxy transactionAwareDataSource() %7B%0A%09%09return new TransactionAwareDataSourceProxy(dataSource());%0A%09%7D%0A%0A%09@Bean%0A%09public DataSourceTransactionManager transactionManager() %7B%0A%09%09return new DataSourceTransactionManager(dataSource());%0A%09%7D%0A%0A%09@Bean%0A%09public DataSourceConnectionProvider connectionProvider() %7B%0A%09%09return new DataSourceConnectionProvider(transactionAwareDataSource());%0A%09%7D%0A%0A%09@Bean%0A%09public DefaultConfiguration configuration() %7B%0A%09%09DefaultConfiguration jooqConfiguration = new DefaultConfiguration();%0A%09%09jooqConfiguration.set(SQLDialect.POSTGRES);%0A%09%09jooqConfiguration.setConnectionProvider(connectionProvider());%0A%09%09return jooqConfiguration;%0A%09%7D%0A%0A%09@Bean%0A%09public DefaultDSLContext dsl() %7B%0A%09%09return new DefaultDSLContext(configuration());%0A%09%7D%0A%7D%0A

add database configuration