@Bean public LocalContainerEntityManagerFactoryBean entityManagerFactoryBean() { Map<String, Object> properties = new HashMap<String, Object>(); properties.put("configured", "manually"); properties.put("hibernate.transaction.jta.platform", NoJtaPlatform.INSTANCE); return new EntityManagerFactoryBuilder(new HibernateJpaVendorAdapter(), properties, null).dataSource(this.dataSource).build(); }
@Bean public LocalContainerEntityManagerFactoryBean entityManagerFactory( DataSource dataSource, JpaVendorAdapter adapter) { LocalContainerEntityManagerFactoryBean factoryBean = new LocalContainerEntityManagerFactoryBean(); factoryBean.setJpaVendorAdapter(adapter); factoryBean.setDataSource(dataSource); factoryBean.setPersistenceUnitName("manually-configured"); Map<String, Object> properties = new HashMap<String, Object>(); properties.put("configured", "manually"); properties.put("hibernate.transaction.jta.platform", NoJtaPlatform.INSTANCE); factoryBean.setJpaPropertyMap(properties); return factoryBean; }
@Bean public EntityManagerFactory entityManagerFactory(DataSource dataSource, JpaVendorAdapter adapter) { LocalContainerEntityManagerFactoryBean factoryBean = new LocalContainerEntityManagerFactoryBean(); factoryBean.setJpaVendorAdapter(adapter); factoryBean.setDataSource(dataSource); factoryBean.setPersistenceUnitName("manually-configured"); Map<String, Object> properties = new HashMap<String, Object>(); properties.put("configured", "manually"); properties.put("hibernate.transaction.jta.platform", NoJtaPlatform.INSTANCE); factoryBean.setJpaPropertyMap(properties); factoryBean.afterPropertiesSet(); return factoryBean.getObject(); }