@Bean public LocalContainerEntityManagerFactoryBean entityManagerFactoryBean() throws ClassNotFoundException { LocalContainerEntityManagerFactoryBean entityManagerFactoryBean = new LocalContainerEntityManagerFactoryBean(); entityManagerFactoryBean.setDataSource(dataSource()); entityManagerFactoryBean.setPackagesToScan( environment.getRequiredProperty(PROPERTY_NAME_ENTITYMANAGER_PACKAGES_TO_SCAN)); entityManagerFactoryBean.setPersistenceProviderClass(HibernatePersistence.class); Properties jpaProterties = new Properties(); jpaProterties.put( PROPERTY_NAME_HIBERNATE_DIALECT, environment.getRequiredProperty(PROPERTY_NAME_HIBERNATE_DIALECT)); jpaProterties.put( PROPERTY_NAME_HIBERNATE_FORMAT_SQL, environment.getRequiredProperty(PROPERTY_NAME_HIBERNATE_FORMAT_SQL)); jpaProterties.put( PROPERTY_NAME_HIBERNATE_NAMING_STRATEGY, environment.getRequiredProperty(PROPERTY_NAME_HIBERNATE_NAMING_STRATEGY)); jpaProterties.put( PROPERTY_NAME_HIBERNATE_SHOW_SQL, environment.getRequiredProperty(PROPERTY_NAME_HIBERNATE_SHOW_SQL)); entityManagerFactoryBean.setJpaProperties(jpaProterties); return entityManagerFactoryBean; }
@Bean LocalContainerEntityManagerFactoryBean entityManagerFactory( DataSource dataSource, Environment env) { LocalContainerEntityManagerFactoryBean entityManagerFactoryBean = new LocalContainerEntityManagerFactoryBean(); entityManagerFactoryBean.setDataSource(dataSource); entityManagerFactoryBean.setJpaVendorAdapter(new HibernateJpaVendorAdapter()); entityManagerFactoryBean.setPackagesToScan("es.udc.lbd.rie"); Properties jpaProperties = new Properties(); // Configures the used database dialect. This allows Hibernate to create SQL // that is optimized for the used database. jpaProperties.put("hibernate.dialect", env.getRequiredProperty("hibernate.dialect")); // Configures the naming strategy that is used when Hibernate creates // new database objects and schema elements jpaProperties.put( "hibernate.ejb.naming_strategy", env.getRequiredProperty("hibernate.ejb.naming_strategy")); // If the value of this property is true, Hibernate writes all SQL // statements to the console. jpaProperties.put("hibernate.show_sql", env.getRequiredProperty("hibernate.show_sql")); // If the value of this property is true, Hibernate will format the SQL // that is written to the console. jpaProperties.put("hibernate.format_sql", env.getRequiredProperty("hibernate.format_sql")); entityManagerFactoryBean.setJpaProperties(jpaProperties); return entityManagerFactoryBean; }
@Bean(name = "entityManagerFactory") public LocalContainerEntityManagerFactoryBean entityManagerFactoryBean() { LocalContainerEntityManagerFactoryBean factoryBean = new LocalContainerEntityManagerFactoryBean(); factoryBean.setDataSource(dataSource()); factoryBean.setPersistenceUnitName("a1ecommerceEntityManager"); factoryBean.setPackagesToScan(new String[] {"com.a1electronics.ecommerce.dbo"}); HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter(); factoryBean.setJpaVendorAdapter(vendorAdapter); Properties jpaProperties = new Properties(); // Configures the used database dialect. This allows Hibernate to create // SQL // that is optimized for the used database. jpaProperties.put("hibernate.dialect", env.getRequiredProperty("hibernate.dialect")); // If the value of this property is true, Hibernate writes all SQL // statements to the console. jpaProperties.put("hibernate.show_sql", env.getRequiredProperty("hibernate.show_sql")); // If the value of this property is true, Hibernate will format the SQL // that is written to the console. jpaProperties.put("hibernate.format_sql", env.getRequiredProperty("hibernate.format_sql")); // jpaProperties.put("hibernate.hbm2ddl.auto",env.getRequiredProperty("hibernate.hbm2ddl.auto")); // To fix the followinf issue // HHH000424: Disabling contextual LOB creation as createClob() method threw error : // java.lang.reflect.InvocationTargetException jpaProperties.put("hibernate.temp.use_jdbc_metadata_defaults", false); factoryBean.setJpaProperties(jpaProperties); factoryBean.afterPropertiesSet(); factoryBean.setLoadTimeWeaver(new InstrumentationLoadTimeWeaver()); // factoryBean.setPersistenceUnitName(env.getRequiredProperty("persistence.unitName")); return factoryBean; }
@Bean(name = "entityManagerFactory", destroyMethod = "destroy") LocalContainerEntityManagerFactoryBean entityManagerFactoryBean( DataSource dataSource, Environment env) { LocalContainerEntityManagerFactoryBean entityManagerFactoryBean = new LocalContainerEntityManagerFactoryBean(); entityManagerFactoryBean.setDataSource(dataSource); entityManagerFactoryBean.setJpaVendorAdapter(new HibernateJpaVendorAdapter()); entityManagerFactoryBean.setPackagesToScan("com.test.mmm.entity"); // added for scanning hbm files ClasspathScanningPersistenceUnitPostProcessor classpathScanningPersistenceUnitPostProcessor = new ClasspathScanningPersistenceUnitPostProcessor("com.test.mmm.entity"); classpathScanningPersistenceUnitPostProcessor.setMappingFileNamePattern("*.hbm.xml"); entityManagerFactoryBean.setPersistenceUnitPostProcessors( classpathScanningPersistenceUnitPostProcessor); Properties properties = new Properties(); properties.put("hibernate.dialect", env.getProperty("hibernate.dialect")); properties.put("hibernate.show_sql", env.getProperty("hibernate.show_sql")); properties.put("hibernate.format_sql", env.getProperty("hibernate.format_sql")); properties.put("hibernate.hbm2ddl.auto", env.getProperty("hibernate.hbm2ddl.auto")); entityManagerFactoryBean.setJpaProperties(properties); return entityManagerFactoryBean; }
@Bean public EntityManagerFactory entityManagerFactory() { Properties jpaProterties = new Properties(); jpaProterties.put("hibernate.dialect", environment.getRequiredProperty("hibernate.dialect")); jpaProterties.put( "hibernate.format_sql", environment.getRequiredProperty("hibernate.format_sql")); jpaProterties.put( "hibernate.ejb.naming_strategy", environment.getRequiredProperty("hibernate.ejb.naming_strategy")); jpaProterties.put("hibernate.show_sql", environment.getRequiredProperty("hibernate.show_sql")); jpaProterties.put( "hibernate.generate_statistics", environment.getRequiredProperty("hibernate.generate_statistics")); HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter(); vendorAdapter.setGenerateDdl(false); LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean(); factory.setJpaVendorAdapter(vendorAdapter); factory.setPackagesToScan("br.com.uol.cubus.support.domain"); factory.setDataSource(dataSource()); factory.setJpaProperties(jpaProterties); factory.afterPropertiesSet(); return factory.getObject(); }
@Bean public LocalContainerEntityManagerFactoryBean entityManagerFactory() { LocalContainerEntityManagerFactoryBean entityManagerFactoryBean = new LocalContainerEntityManagerFactoryBean(); entityManagerFactoryBean.setDataSource(dataSource()); entityManagerFactoryBean.setJpaVendorAdapter(new HibernateJpaVendorAdapter()); entityManagerFactoryBean.setPackagesToScan(PROPERTY_PACKAGES_TO_SCAN); Properties jpaProperties = new Properties(); jpaProperties.put( PROPERTY_NAME_HIBERNATE_DIALECT, environment.getRequiredProperty(PROPERTY_NAME_HIBERNATE_DIALECT)); jpaProperties.put( PROPERTY_NAME_HIBERNATE_FORMAT_SQL, environment.getRequiredProperty(PROPERTY_NAME_HIBERNATE_FORMAT_SQL)); jpaProperties.put( PROPERTY_NAME_HIBERNATE_HBM2DDL_AUTO, environment.getRequiredProperty(PROPERTY_NAME_HIBERNATE_HBM2DDL_AUTO)); jpaProperties.put( PROPERTY_NAME_HIBERNATE_NAMING_STRATEGY, environment.getRequiredProperty(PROPERTY_NAME_HIBERNATE_NAMING_STRATEGY)); jpaProperties.put( PROPERTY_NAME_HIBERNATE_SHOW_SQL, environment.getRequiredProperty(PROPERTY_NAME_HIBERNATE_SHOW_SQL)); entityManagerFactoryBean.setJpaProperties(jpaProperties); return entityManagerFactoryBean; }
@Bean public FactoryBean<EntityManagerFactory> entityManagerFactory() { LocalContainerEntityManagerFactoryBean localContainerEntityManagerFactoryBean = new LocalContainerEntityManagerFactoryBean(); localContainerEntityManagerFactoryBean.setJpaProperties(properties); localContainerEntityManagerFactoryBean.setDataSource(dataSource); localContainerEntityManagerFactoryBean.setJpaVendorAdapter(jpaVendorAdapter()); return localContainerEntityManagerFactoryBean; }
/** * Configures the entity manager factory. * * <p>Sets the default data source using the <code>dataSource()</code> method. Sets JPA Vendor * adapter using the <code>jpaVendorAdapter()</code> method. Sets Hibernate properties using the * <code>hibernateProperties()</code> method. Entities in the package <code>org.wfp.fittest.entity * </code> are scanned automatically. * * @return LocalContainerEntityManagerFactoryBean * @see EntityManagerFactory */ @Bean(name = "entityManagerFactory") public LocalContainerEntityManagerFactoryBean entityManagerFactory() { LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean(); em.setDataSource(dataSource()); em.setPackagesToScan(new String[] {"org.wfp.fittest.entity"}); em.setJpaVendorAdapter(jpaVendorAdapter()); em.setJpaProperties(hibernateProperties()); return em; }
@Bean public LocalContainerEntityManagerFactoryBean entityManagerFactory() { LocalContainerEntityManagerFactoryBean emf = new LocalContainerEntityManagerFactoryBean(); emf.setDataSource(dataSource()); JpaVendorAdapter jpaVendorAdapter = new HibernateJpaVendorAdapter(); emf.setJpaVendorAdapter(jpaVendorAdapter); emf.setJpaProperties(jpaPropertiesForEMF()); emf.setPackagesToScan(mappingPackagesToScan); return emf; }
@Bean public LocalContainerEntityManagerFactoryBean entityManagerFactory() { final LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean(); em.setDataSource(dataSource()); em.setPackagesToScan(new String[] {"com.sentinel.persistence.models"}); final HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter(); em.setJpaVendorAdapter(vendorAdapter); em.setJpaProperties(additionalProperties()); return em; }
@Bean public LocalContainerEntityManagerFactoryBean entityManagerFactory() { LocalContainerEntityManagerFactoryBean entityManagerFactoryBean = new LocalContainerEntityManagerFactoryBean(); entityManagerFactoryBean.setDataSource(dataSource()); entityManagerFactoryBean.setJpaVendorAdapter(jpaVendorAdapter()); entityManagerFactoryBean.setPackagesToScan("com.softserveinc.ita.kaiji"); entityManagerFactoryBean.setJpaProperties(jpaProperties()); return entityManagerFactoryBean; }
@Bean public LocalContainerEntityManagerFactoryBean entityManagerFactory() { LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean(); em.setDataSource(dataSource()); em.setPackagesToScan(new String[] {"ph.com.alliance.entity"}); JpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter(); em.setJpaVendorAdapter(vendorAdapter); em.setJpaProperties(additionalProperties()); return em; }
@Qualifier("user_manager") @Bean(name = "user_manager_EntityManagerFactory") public LocalContainerEntityManagerFactoryBean entityManagerFactory() { final LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean(); em.setDataSource(dataSource()); em.setPackagesToScan("com.bluntsoftware.MyApp.modules.user_manager.domain"); final HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter(); em.setJpaVendorAdapter(vendorAdapter); em.setJpaProperties(additionalProperties()); return em; }
@Bean public LocalContainerEntityManagerFactoryBean entityManagerFactory( DataSource dataSource, JpaVendorAdapter jpaVendorAdapter) { LocalContainerEntityManagerFactoryBean emf = new LocalContainerEntityManagerFactoryBean(); emf.setDataSource(dataSource); emf.setPersistenceUnitName("reportServer"); emf.setJpaVendorAdapter(jpaVendorAdapter); emf.setJpaProperties(additionalProperties()); emf.setPackagesToScan("com.qfree.obo.report.domain"); return emf; }
@Bean() public LocalContainerEntityManagerFactoryBean entityManagerFactory() { LocalContainerEntityManagerFactoryBean retVal = new LocalContainerEntityManagerFactoryBean(); retVal.setPersistenceUnitName("HAPI_PU"); retVal.setDataSource(dataSource()); retVal.setPackagesToScan("ca.uhn.fhir.jpa.entity"); retVal.setPersistenceProvider(new HibernatePersistenceProvider()); retVal.setJpaProperties(jpaProperties()); retVal.afterPropertiesSet(); return retVal; }
@Bean(name = "entityManagerFactory") @DependsOn({"liquibase", "dataSource"}) FactoryBean<EntityManagerFactory> emf(JpaVendorAdapter jpaVendorAdapter) { SimpleHiloIdentifierGenerator.setDataSource(dataSource()); LocalContainerEntityManagerFactoryBean fb = new LocalContainerEntityManagerFactoryBean(); fb.setJpaProperties(hibernateProperties()); fb.setDataSource(dataSource()); fb.setPersistenceProviderClass(HibernatePersistence.class); fb.setPackagesToScan("io.cloudslang"); fb.setJpaVendorAdapter(jpaVendorAdapter); return fb; }
@Bean public LocalContainerEntityManagerFactoryBean entityManagerFactory(DataSource dataSource) { LocalContainerEntityManagerFactoryBean emf = new LocalContainerEntityManagerFactoryBean(); emf.setDataSource(dataSource); emf.setPackagesToScan(new String[] {"com.urbanhive.model"}); JpaVendorAdapter adapter = new HibernateJpaVendorAdapter(); emf.setJpaVendorAdapter(adapter); emf.setJpaProperties(otherProperties()); return emf; }
@Bean public LocalContainerEntityManagerFactoryBean entityManagerFactory() { LocalContainerEntityManagerFactoryBean emf = new LocalContainerEntityManagerFactoryBean(); emf.setDataSource(dataSource()); emf.setPackagesToScan(new String[] {"com.nuance.vdmach.model.entities"}); JpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter(); emf.setJpaVendorAdapter(vendorAdapter); emf.setJpaProperties(additionalProperties()); return emf; }
@Bean public LocalContainerEntityManagerFactoryBean entityManagerFactory() { LocalContainerEntityManagerFactoryBean entityManagerFactoryBean = new LocalContainerEntityManagerFactoryBean(); entityManagerFactoryBean.setDataSource(dataSource()); entityManagerFactoryBean.setPersistenceProviderClass(HibernatePersistence.class); entityManagerFactoryBean.setPackagesToScan( env.getRequiredProperty(PROP_ENTITYMANAGER_PACKAGES_TO_SCAN)); entityManagerFactoryBean.setJpaProperties(getHibernateProperties()); return entityManagerFactoryBean; }
@Bean public LocalContainerEntityManagerFactoryBean entityManagerFactory() throws URISyntaxException { LocalContainerEntityManagerFactoryBean entityManagerFactoryBean = new LocalContainerEntityManagerFactoryBean(); entityManagerFactoryBean.setDataSource(dataSource()); entityManagerFactoryBean.setPersistenceProviderClass(HibernatePersistenceProvider.class); entityManagerFactoryBean.setJpaProperties(hibProperties()); entityManagerFactoryBean.setPackagesToScan( env.getRequiredProperty(PROPERTY_HIBERNATE_PACKAGES_TO_SCAN)); entityManagerFactoryBean.setPersistenceUnitName("javapress"); return entityManagerFactoryBean; }
@Bean(name = "entityManagerFactory") public LocalContainerEntityManagerFactoryBean entityManagerFactory(DataSource dataSource) { LocalContainerEntityManagerFactoryBean entityManagerFactoryBean = new LocalContainerEntityManagerFactoryBean(); entityManagerFactoryBean.setDataSource(dataSource); entityManagerFactoryBean.setPackagesToScan("com.spring.boilerplate.common.domain"); entityManagerFactoryBean.setLoadTimeWeaver(new InstrumentationLoadTimeWeaver()); entityManagerFactoryBean.setJpaVendorAdapter(new HibernateJpaVendorAdapter()); entityManagerFactoryBean.setJpaProperties(hibernateProperties()); return entityManagerFactoryBean; }
@Bean public LocalContainerEntityManagerFactoryBean configureEntityManagerFactory() { LocalContainerEntityManagerFactoryBean entityManagerFactoryBean = new LocalContainerEntityManagerFactoryBean(); entityManagerFactoryBean.setDataSource(configureDataSource()); entityManagerFactoryBean.setPackagesToScan("basic"); entityManagerFactoryBean.setJpaVendorAdapter(new HibernateJpaVendorAdapter()); Properties jpaProperties = new Properties(); jpaProperties.put(org.hibernate.cfg.Environment.DIALECT, dialect); jpaProperties.put(org.hibernate.cfg.Environment.HBM2DDL_AUTO, hbm2ddlAuto); entityManagerFactoryBean.setJpaProperties(jpaProperties); return entityManagerFactoryBean; }
@Bean public LocalContainerEntityManagerFactoryBean configureEntityManagerFactory() { LocalContainerEntityManagerFactoryBean entityManagerFactoryBean = new LocalContainerEntityManagerFactoryBean(); entityManagerFactoryBean.setDataSource(configureDataSource()); entityManagerFactoryBean.setJpaVendorAdapter(new HibernateJpaVendorAdapter()); entityManagerFactoryBean.setPackagesToScan( "com.bs.service.firmacentralizada.auditoria.entidades"); Properties jpaProperties = new Properties(); jpaProperties.put(org.hibernate.cfg.Environment.SHOW_SQL, true); jpaProperties.put(org.hibernate.cfg.Environment.FORMAT_SQL, true); entityManagerFactoryBean.setJpaProperties(jpaProperties); return entityManagerFactoryBean; }
@Bean(name = "entityManagerFactory") public LocalContainerEntityManagerFactoryBean emf() throws IOException { Properties jpaProps = new Properties(); jpaProps.load(AppConfig.class.getClassLoader().getResourceAsStream("jpa.properties")); LocalContainerEntityManagerFactoryBean emf = new LocalContainerEntityManagerFactoryBean(); emf.setDataSource(dataSource()); emf.setJpaVendorAdapter(jpaVendorAdapter()); emf.setPackagesToScan("com.beam.sample.model.jpa"); emf.setJpaProperties(jpaProps); emf.setPersistenceProvider(persistenceProvider()); return emf; }
@Bean public EntityManagerFactory entityManagerFactory() { HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter(); vendorAdapter.setShowSql(showSql()); LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean(); factory.setJpaVendorAdapter(vendorAdapter); factory.setPackagesToScan("com.softtech.web.model"); factory.setJpaProperties(additionalProperties()); factory.setDataSource(dataSource()); factory.afterPropertiesSet(); return factory.getObject(); }
@Bean public LocalContainerEntityManagerFactoryBean entityManagerFactoryBean(DataSource dSource) { LocalContainerEntityManagerFactoryBean factoryBean = new LocalContainerEntityManagerFactoryBean(); factoryBean.setDataSource(dSource); factoryBean.setPackagesToScan(new String[] {"model"}); JpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter(); factoryBean.setJpaVendorAdapter(vendorAdapter); factoryBean.setJpaProperties(addtionalProperties()); return factoryBean; }
@Bean public LocalContainerEntityManagerFactoryBean entityManagerFactory() { LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean(); em.setDataSource(dataSource()); em.setPackagesToScan(new String[] {"com.miller.timekeep"}); JpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter(); em.setJpaVendorAdapter(vendorAdapter); Properties properties = new Properties(); properties.setProperty("hibernate.hbm2ddl.auto", "update"); properties.setProperty("hibernate.show_sql", "true"); properties.setProperty("hibernate.dialect", "org.hibernate.dialect.HSQLDialect"); em.setJpaProperties(properties); return em; }
@Bean public LocalContainerEntityManagerFactoryBean entityManagerFactory( DataSource dataSource, JpaVendorAdapter jpaVendorAdapter) { LocalContainerEntityManagerFactoryBean lef = new LocalContainerEntityManagerFactoryBean(); lef.setDataSource(dataSource); lef.setPackagesToScan("io.github.qwefgh90.crawler.persistent.domain"); // persistence 설정 jpaProperties Properties jpaProperties = new Properties(); jpaProperties.setProperty("hibernate.hbm2ddl.auto", "create"); lef.setJpaVendorAdapter(jpaVendorAdapter); lef.setJpaProperties(jpaProperties); lef.setJpaPropertyMap(Collections.singletonMap("javax.persistence.validation.mode", "none")); return lef; }
@Bean public LocalContainerEntityManagerFactoryBean entityManagerFactory() { LocalContainerEntityManagerFactoryBean entityManagerFactoryBean = new LocalContainerEntityManagerFactoryBean(); entityManagerFactoryBean.setDataSource(dataSource()); entityManagerFactoryBean.setJpaVendorAdapter(new HibernateJpaVendorAdapter()); entityManagerFactoryBean.setPackagesToScan(PACKAGES_TO_SCAN); Properties jpaProperties = new Properties(); jpaProperties.put("hibernate.dialect", "org.hibernate.dialect.MySQL5Dialect"); jpaProperties.put("hibernate.show_sql", "true"); entityManagerFactoryBean.setJpaProperties(jpaProperties); return entityManagerFactoryBean; }
@Bean public LocalContainerEntityManagerFactoryBean entityManagerFactory(Environment env) throws Exception { HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter(); vendorAdapter.setGenerateDdl(Boolean.TRUE); vendorAdapter.setShowSql(Boolean.TRUE); LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean(); factory.setJpaVendorAdapter(vendorAdapter); factory.setPackagesToScan("com.dawidkotarba.playground.model.entities"); factory.setDataSource(dataSource(env)); factory.setJpaProperties(jpaProperties()); factory.setLoadTimeWeaver(new InstrumentationLoadTimeWeaver()); return factory; }