Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Unable to build Hibernate SessionFactory
- @EnableTransactionManagement
- public class JPAConfiguration {
- @Bean
- public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
- LocalContainerEntityManagerFactoryBean emf = new LocalContainerEntityManagerFactoryBean();
- JpaVendorAdapter jpaVendorAdapter = new HibernateJpaVendorAdapter();
- emf.setJpaVendorAdapter(jpaVendorAdapter );
- DriverManagerDataSource dataSource = new DriverManagerDataSource();
- dataSource.setUsername("root");
- dataSource.setPassword("123123");
- dataSource.setUrl("jdbc:mysql://127.0.0.1:3306/sistema-web-05");
- dataSource.setDriverClassName("com.mysql.jdbc.Driver");
- Properties properties = new Properties();
- properties.setProperty("hibernate.dialect", "org.hibernate.dialect.MySQL5Dialect");
- properties.setProperty("hibernate.show_sql", "true");
- properties.setProperty("hibernate.hbm2ddl.auto", "update");
- emf.setJpaProperties(properties);
- emf.setPackagesToScan("sistema.estoque.springmvc.model");
- return emf;
- }
- @Bean
- public JpaTransactionManager transactionManager(EntityManagerFactory emf) {
- return new JpaTransactionManager(emf);
- }
- }
Add Comment
Please, Sign In to add comment