package hotels.business.configuration;

import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;
import org.springframework.context.annotation.PropertySource;
import org.springframework.transaction.annotation.EnableTransactionManagement;

/**
 * Created by Iwan on 04.05.2016.
 */
@Profile("prod")
@Configuration
@EnableTransactionManagement
@PropertySource("classpath:/prod.properties")
public class MySqlConfiguration {
}

@@ -33,16 +33,127 @@
 ation;%0A%0A
+import org.springframework.beans.factory.annotation.Value;%0Aimport org.springframework.context.annotation.Bean;%0A
 import o
@@ -322,16 +322,222 @@
 Source;%0A
+import org.springframework.jdbc.datasource.DriverManagerDataSource;%0Aimport org.springframework.orm.hibernate4.HibernateTransactionManager;%0Aimport org.springframework.orm.hibernate4.LocalSessionFactoryBean;%0A
 import o
@@ -608,16 +608,75 @@
 ement;%0A%0A
+import javax.sql.DataSource;%0Aimport java.util.Properties;%0A%0A
 /**%0A * C
@@ -745,37 +745,8 @@
 ion%0A
-@EnableTransactionManagement%0A
 @Pro
@@ -787,16 +787,45 @@
 rties%22)%0A
+@EnableTransactionManagement%0A
 public c
@@ -850,10 +850,1760 @@
 ation %7B%0A
+%0A    @Value( %22$%7Bdb.driver%7D%22 )%0A    private String dbDriver;%0A%0A    @Value( %22$%7Bdb.password%7D%22 )%0A    private String dbPassword;%0A%0A    @Value( %22$%7Bdb.url%7D%22 )%0A    private String dbUrl;%0A%0A    @Value( %22$%7Bdb.username%7D%22 )%0A    private String dbUsername;%0A%0A    @Value( %22$%7Bhibernate.dialect%7D%22 )%0A    private String dialect;%0A%0A    @Value( %22$%7Bhibernate.show_sql%7D%22 )%0A    private String dbShowSql;%0A%0A    @Value( %22$%7Bhibernate.hbm2ddl.auto%7D%22 )%0A    private String dbHbm2ddl;%0A%0A    @Bean%0A    public DataSource dataSource() %7B%0A        DriverManagerDataSource dataSource = new DriverManagerDataSource();%0A%0A        dataSource.setDriverClassName( dbDriver );%0A        dataSource.setUrl( dbUrl );%0A        dataSource.setUsername( dbUsername );%0A        dataSource.setPassword( dbPassword );%0A        return dataSource;%0A    %7D%0A%0A    @Bean%0A    public LocalSessionFactoryBean sessionFactory() %7B%0A        LocalSessionFactoryBean sessionFactoryBean;%0A%0A        sessionFactoryBean = new LocalSessionFactoryBean();%0A        sessionFactoryBean.setDataSource( dataSource() );%0A        sessionFactoryBean.setPackagesToScan( %22hotels.business%22 );%0A        Properties hibernateProperties = new Properties();%0A        hibernateProperties.put( %22hibernate.dialect%22, dialect );%0A        hibernateProperties.put( %22hibernate.show_sql%22, dbShowSql );%0A        hibernateProperties.put( %22hibernate.hbm2ddl.auto%22, dbHbm2ddl );%0A        sessionFactoryBean.setHibernateProperties( hibernateProperties );%0A        return sessionFactoryBean;%0A    %7D%0A%0A    @Bean%0A    public HibernateTransactionManager transactionManager() %7B%0A        HibernateTransactionManager transactionManager = new HibernateTransactionManager();%0A        transactionManager.setSessionFactory( sessionFactory().getObject() );%0A        return transactionManager;%0A    %7D%0A%0A
 %7D%0A

add conn