content: package spring.project.configure;
  
  import org.springframework.context.annotation.Bean;
  import org.springframework.context.annotation.Configuration;
  import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
  import org.springframework.orm.jpa.JpaTransactionManager;
  import org.springframework.orm.jpa.LocalEntityManagerFactoryBean;
  import org.springframework.transaction.annotation.EnableTransactionManagement;
  
  import javax.persistence.EntityManagerFactory;
  
  /**
   * @Created 04 / 05 / 2020 - 5:46 PM
   * @project EmployeeSearch
   * @Author Hamdamboy
   */
  @Configuration
  @EnableJpaRepositories
  @EnableTransactionManagement
  public class JpaConfig {
  
      @Bean
      public LocalEntityManagerFactoryBean entityManagerFactory() {
          LocalEntityManagerFactoryBean factoryBean = new LocalEntityManagerFactoryBean();
          factoryBean.setPersistenceUnitName("SalesDB");
  
          return factoryBean;
      }
  
      @Bean
      public JpaTransactionManager transactionManager(EntityManagerFactory entityManagerFactory) {
          JpaTransactionManager transactionManager = new JpaTransactionManager();
          transactionManager.setEntityManagerFactory(entityManagerFactory);
  
          return transactionManager;
      }
  }
  