Java Code Examples for org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder.Builder#packages()
The following examples show how to use
org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder.Builder#packages() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: OrmRepository.java From sample-boot-micro with MIT License | 5 votes |
public LocalContainerEntityManagerFactoryBean entityManagerFactoryBean(String name, final DataSource dataSource) { EntityManagerFactoryBuilder emfBuilder = new EntityManagerFactoryBuilder( vendorAdapter(), getProperties(), null); Builder builder = emfBuilder .dataSource(dataSource) .persistenceUnit(name) .properties(hibernate.determineHibernateProperties(getProperties(), new HibernateSettings())) .jta(false); if (ArrayUtils.isNotEmpty(annotatedClasses)) { builder.packages(annotatedClasses); } else { builder.packages(packageToScan); } return builder.build(); }
Example 2
Source File: OrmRepository.java From sample-boot-hibernate with MIT License | 5 votes |
public LocalContainerEntityManagerFactoryBean entityManagerFactoryBean(String name, final DataSource dataSource) { EntityManagerFactoryBuilder emfBuilder = new EntityManagerFactoryBuilder( vendorAdapter(), getProperties(), null); Builder builder = emfBuilder .dataSource(dataSource) .persistenceUnit(name) .properties(hibernate.determineHibernateProperties(getProperties(), new HibernateSettings())) .jta(false); if (ArrayUtils.isNotEmpty(annotatedClasses)) { builder.packages(annotatedClasses); } else { builder.packages(packageToScan); } return builder.build(); }
Example 3
Source File: EntityTestSupport.java From ddd-java with MIT License | 5 votes |
protected void setupEntityManagerFactory() { DataSource ds = EntityTestFactory.dataSource(); Map<String, String> props = new HashMap<>(); props.put(AvailableSettings.HBM2DDL_AUTO, "create-drop"); Builder builder = new EntityManagerFactoryBuilder(new HibernateJpaVendorAdapter(), props, null) .dataSource(ds) .jta(false); if (!targetEntities.isEmpty()) { builder.packages(targetEntities.toArray(new Class<?>[0])); } LocalContainerEntityManagerFactoryBean emfBean = builder.build(); emfBean.afterPropertiesSet(); emf = emfBean.getObject(); txm = new JpaTransactionManager(emf); }