Java 类org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean 实例源码

项目:spring-seed    文件:JpaBuilderUtil.java   
public static EntityManagerFactory newEntityManagerFactory(DataSource dataSource, Class<?> ... entityPackages){
    HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
    vendorAdapter.setGenerateDdl(true);

    BasicDataSource basicDataSource = (BasicDataSource)dataSource;
    Database jpaDatabase = DatabaseType.findTypeByJdbcUrl(basicDataSource.getUrl()).getJpaDatabase();
    vendorAdapter.setDatabase(jpaDatabase);

    HashMap<String, Object> properties = new HashMap<String, Object>();
    //properties.put("hibernate.dialect", "org.hibernate.dialect.MySQL5InnoDBDialect");

    LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean();
    factory.setJpaVendorAdapter(vendorAdapter);
    //import @Entity classes
    factory.setPackagesToScan(Arrays.stream(entityPackages).map(thing -> thing.getPackage().getName()).toArray(String[]::new));
    //factory.setPersistenceUnitName("jproject");
    factory.setDataSource(dataSource);
    factory.setJpaPropertyMap(properties);
    factory.afterPropertiesSet();

    return factory.getObject();
}
项目:xm-uaa    文件:DatabaseConfiguration.java   
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory(
    DataSource dataSource,
    MultiTenantConnectionProvider multiTenantConnectionProviderImpl,
    CurrentTenantIdentifierResolver currentTenantIdentifierResolverImpl) {
    Map<String, Object> properties = new HashMap<>();
    properties.putAll(jpaProperties.getHibernateProperties(dataSource));
    properties.put(org.hibernate.cfg.Environment.MULTI_TENANT, MultiTenancyStrategy.SCHEMA);
    properties
        .put(org.hibernate.cfg.Environment.MULTI_TENANT_CONNECTION_PROVIDER, multiTenantConnectionProviderImpl);
    properties
        .put(org.hibernate.cfg.Environment.MULTI_TENANT_IDENTIFIER_RESOLVER, currentTenantIdentifierResolverImpl);

    LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean();
    em.setDataSource(dataSource);
    em.setPackagesToScan(JPA_PACKAGES);
    em.setJpaVendorAdapter(jpaVendorAdapter());
    em.setJpaPropertyMap(properties);
    return em;
}
项目:REST-Web-Services    文件:WebDatasourceConfig.java   
/**
     * EntityManager configuration.
     */
    @Bean(name = "entityManagerFactory")
    public LocalContainerEntityManagerFactoryBean entityManagerFactoryBean() {
        final LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean();
        em.setDataSource(getDatasource());
        em.setJpaDialect(jpaDialect());
        em.setPackagesToScan(entityManagerProperties.getPackagesToScan());
        em.setPersistenceUnitName(eclipseLinkProperties.getPersistenceUnitName());
        final DatabasePlatform dp = new MySQLPlatform();
        em.setJpaVendorAdapter(getEclipseLinkJpaVendorAdapter());

        //following code will be used for static weaving. Uncomment when creating war.
        final Map<String, String> propMap = new HashMap<String, String>();
        propMap.put("eclipselink.weaving", eclipseLinkProperties.getWeaving());
        em.setJpaPropertyMap(propMap);

//        em.setLoadTimeWeaver(loadTimeWeaver()); //comment this when using static weaving. Mostly in development environment inside eclipse
        return em;
    }
项目:amv-access-api-poc    文件:JpaConfig.java   
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
    // JPA settings
    HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
    // vendorAdapter.setGenerateDdl(true);
    // vendorAdapter.setShowSql(true);
    vendorAdapter.setDatabase(Database.MYSQL);

    LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean();
    factory.setJpaVendorAdapter(vendorAdapter);
    factory.setPackagesToScan("org.amv.access.model");
    factory.setDataSource(dataSource);
    factory.setJpaProperties(jpaProperties());
    factory.afterPropertiesSet();
    return factory;
}
项目:chimera    文件:JPosDatabaseAutoConfiguration.java   
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory(
    EntityManagerFactoryBuilder factoryBuilder)
{
    Map<String, Object> vendorProperties = getVendorProperties();
    customizeVendorProperties(vendorProperties);
    LocalContainerEntityManagerFactoryBean emfb = factoryBuilder.dataSource(getDataSource())
        .packages(getPackagesToScan())
        .persistenceUnit("default")
        .properties(vendorProperties)
        .jta(isJta())
        .build();

    emfb.setPersistenceUnitPostProcessors(new JPosPersistentUnitPostProcessor());
    return emfb;
}
项目:xm-ms-balance    文件:DatabaseConfiguration.java   
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory(
    DataSource dataSource,
    MultiTenantConnectionProvider multiTenantConnectionProviderImpl,
    CurrentTenantIdentifierResolver currentTenantIdentifierResolverImpl,
    LocalValidatorFactoryBean localValidatorFactoryBean) {

    Map<String, Object> properties = new HashMap<>();
    properties.putAll(jpaProperties.getHibernateProperties(dataSource));
    properties.put(MULTI_TENANT, MultiTenancyStrategy.SCHEMA);
    properties.put(MULTI_TENANT_CONNECTION_PROVIDER, multiTenantConnectionProviderImpl);
    properties.put(MULTI_TENANT_IDENTIFIER_RESOLVER, currentTenantIdentifierResolverImpl);
    properties.put(JPA_VALIDATION_FACTORY, localValidatorFactoryBean);

    LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean();
    em.setDataSource(dataSource);
    em.setPackagesToScan(JPA_PACKAGES);
    em.setJpaVendorAdapter(jpaVendorAdapter());
    em.setJpaPropertyMap(properties);
    return em;
}
项目:devops-cstack    文件:DatabaseConfiguration.java   
@Bean
public EntityManagerFactory entityManagerFactory() {
    logger.debug("Configuring EntityManager");
    LocalContainerEntityManagerFactoryBean lcemfb = new LocalContainerEntityManagerFactoryBean();
    lcemfb.setPersistenceProvider(new HibernatePersistenceProvider());
    lcemfb.setPersistenceUnitName("persistenceUnit");
    lcemfb.setDataSource(dataSource());
    lcemfb.setJpaDialect(new HibernateJpaDialect());
    lcemfb.setJpaVendorAdapter(jpaVendorAdapter());
    lcemfb.setSharedCacheMode(SharedCacheMode.ENABLE_SELECTIVE);
    Properties jpaProperties = new Properties();
    jpaProperties.put("hibernate.generate_statistics", false);
    jpaProperties.put("hibernate.show_sql", Boolean.parseBoolean(databaseShowSQL));
    lcemfb.setJpaProperties(jpaProperties);
    lcemfb.setPackagesToScan("cn.org.once.cstack.model");
    lcemfb.afterPropertiesSet();
    return lcemfb.getObject();
}
项目:Smart-Shopping    文件:JPAConfig.java   
@Bean
public EntityManagerFactory entityManagerFactory() {
    LocalContainerEntityManagerFactoryBean emf = new LocalContainerEntityManagerFactoryBean();
    emf.setDataSource(dataSource());
    emf.setPackagesToScan("io.github.azanx.shopping_list.domain");
    emf.setPersistenceUnitName("spring-jpa-unit");
    emf.setJpaVendorAdapter(getHibernateAdapter());
    Properties jpaProperties = new Properties();
    jpaProperties.put("hibernate.dialect", env.getProperty("hibernate.dialect"));
    jpaProperties.put("hibernate.hbm2ddl.auto", env.getProperty("hibernate.hbm2ddl.auto"));
    jpaProperties.put("hibernate.show_sql", env.getProperty("hibernate.show_sql"));
    jpaProperties.put("hibernate.format_sql", env.getProperty("hibernate.format_sql"));
    emf.setJpaProperties(jpaProperties);
    emf.afterPropertiesSet();
    return emf.getObject();
}
项目:careconnect-reference-implementation    文件:DataSourceConfig.java   
@Bean
public EntityManagerFactory entityManagerFactory(DataSource dataSource) {
    final Database database = Database.valueOf(vendor.toUpperCase());
    /*
    final HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
    vendorAdapter.setShowSql(showSql);
    vendorAdapter.setGenerateDdl(showDdl);
    vendorAdapter.setDatabase(database);
    */

    final LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean();
    factory.setPersistenceUnitName("CCRI_PU");
   // factory.setJpaVendorAdapter(vendorAdapter);
    factory.setPackagesToScan("uk.nhs.careconnect.ri.entity");
    factory.setDataSource(dataSource);
    factory.setPersistenceProvider(new HibernatePersistenceProvider());
    factory.setJpaProperties(jpaProperties());
    factory.afterPropertiesSet();


    return factory.getObject();
}
项目:only-short-poc    文件:MySqlSource1Config.java   
@Bean(EntityManagerFactoryBeanName)
@Primary
public LocalContainerEntityManagerFactoryBean entityManagerFactory(
        @Qualifier(DataSourceBeanName) DataSource dataSource,
        @Qualifier(JpaVendorAdapterBeanName) JpaVendorAdapter vendorAdapter) {

    LocalContainerEntityManagerFactoryBean entityManagerFactoryBean = new LocalContainerEntityManagerFactoryBean();
    entityManagerFactoryBean.setDataSource(dataSource);
    entityManagerFactoryBean.setJpaVendorAdapter(vendorAdapter);
    entityManagerFactoryBean.setJpaDialect(new HibernateJpaDialect());
    entityManagerFactoryBean.setPackagesToScan(Organization.class.getPackage().getName());
    entityManagerFactoryBean.setPersistenceUnitName("mysqlsource1");
    entityManagerFactoryBean.afterPropertiesSet();

    return entityManagerFactoryBean;
}
项目:cloud-s4-sdk-examples    文件:HibernateConfig.java   
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory(DataSource dataSource, MultiTenantConnectionProvider multiTenantConnectionProvider,
                                                                   CurrentTenantIdentifierResolver tenantIdentifierResolver) {
    final LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean();
    em.setDataSource(dataSource);
    em.setPackagesToScan("com.mycompany.models");

    em.setJpaVendorAdapter(this.jpaVendorAdapter());

    final Map<String, Object> jpaProperties = new HashMap<>();
    jpaProperties.put(Environment.MULTI_TENANT, MultiTenancyStrategy.SCHEMA);
    jpaProperties.put(Environment.MULTI_TENANT_CONNECTION_PROVIDER, multiTenantConnectionProvider);
    jpaProperties.put(Environment.MULTI_TENANT_IDENTIFIER_RESOLVER, tenantIdentifierResolver);
    jpaProperties.put(Environment.FORMAT_SQL, true);

    em.setJpaPropertyMap(jpaProperties);
    return em;
}
项目:yadaframework    文件:YadaJpaConfig.java   
@Bean
public EntityManagerFactory entityManagerFactory() throws SQLException {
    HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
    // vendorAdapter.setGenerateDdl(true); // Crea la tabella e le colonne quando non esistono
    vendorAdapter.setShowSql(config.getShowSql());
    vendorAdapter.setDatabasePlatform("org.hibernate.dialect.MySQL5InnoDBDialect");
    LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean();
    factory.setJpaVendorAdapter(vendorAdapter);
    List<String> packages = config.getDbEntityPackages();
    packages.add("net.yadaframework.persistence.entity");
    packages.add("net.yadaframework.security.persistence.entity");
    packages.add("net.yadaframework.cms.persistence.entity");
    packages.add("net.yadaframework.commerce.persistence.entity");
    log.info("Scanning packages for entities: {}", StringUtils.join(packages, ","));
    factory.setPackagesToScan(packages.toArray(new String[]{}));
    factory.setDataSource(dataSource());
    factory.afterPropertiesSet();
    return factory.getObject();
}
项目:holon-datastore-jpa    文件:TestBase.java   
@Bean
public FactoryBean<EntityManagerFactory> entityManagerFactory() {
    LocalContainerEntityManagerFactoryBean emf = new LocalContainerEntityManagerFactoryBean();
    emf.setDataSource(dataSource());
    emf.setJpaVendorAdapter(new HibernateJpaVendorAdapter());
    emf.setPackagesToScan(TestJpaDomain.class.getPackage().getName());
    emf.setPersistenceUnitName("test");
    return emf;
}
项目:TicketServer    文件:SpringBusinessConfig.java   
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
    final LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean();
    em.setDataSource(dataSource());
    em.setPackagesToScan("com.tickets.business.entities");

    final Properties hibernateProperties = new Properties();
    hibernateProperties.setProperty("hibernate.hbm2ddl.auto", "update");
    hibernateProperties.setProperty("hibernate.dialect", "org.hibernate.dialect.MySQL5Dialect");
    em.setJpaProperties(hibernateProperties);

    final HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
    em.setJpaVendorAdapter(vendorAdapter);

    return em;
}
项目:d2g-api    文件:RepositoryConfiguration.java   
/**
 * Big Note: For spring based applications, the difference between different types of the entity manager factory bean is not so much. Spring will
 * always play the role, as container if you configure {@link LocalContainerEntityManagerFactoryBean}  and as application if you configure
 * {@link org.springframework.orm.jpa.LocalEntityManagerFactoryBean}
 *
 * @param dataSource  Factory for connections to the physical data source
 * @param environment Interface representing the environment in which the current application is running.
 * @return suitable entity manager factor bean bean for
 */
@Bean
LocalContainerEntityManagerFactoryBean entityManagerFactory(DataSource dataSource, Environment environment) {
    Properties jpaProperties = new Properties();
    jpaProperties.put("hibernate.dialect", environment.getRequiredProperty("hibernate.dialect"));
    jpaProperties.put("hibernate.hbm2ddl.auto", environment.getRequiredProperty("hibernate.hbm2ddl.auto"));
    jpaProperties.put("hibernate.ejb.naming_strategy", environment.getRequiredProperty("hibernate.ejb.naming_strategy"));
    jpaProperties.put("hibernate.show_sql", environment.getRequiredProperty("hibernate.show_sql"));
    jpaProperties.put("hibernate.format_sql", environment.getRequiredProperty("hibernate.format_sql"));
    LocalContainerEntityManagerFactoryBean entityManagerFactoryBean = new LocalContainerEntityManagerFactoryBean();
    entityManagerFactoryBean.setDataSource(dataSource);
    entityManagerFactoryBean.setJpaVendorAdapter(new HibernateJpaVendorAdapter());
    entityManagerFactoryBean.setPackagesToScan("com.logicify.d2g.models");
    entityManagerFactoryBean.setJpaProperties(jpaProperties);
    return entityManagerFactoryBean;
}
项目:cas-5.1.0    文件:JpaEventsConfiguration.java   
@Lazy
@Bean
public LocalContainerEntityManagerFactoryBean eventsEntityManagerFactory() {
    final LocalContainerEntityManagerFactoryBean bean =
            Beans.newHibernateEntityManagerFactoryBean(
                    new JpaConfigDataHolder(
                            jpaEventVendorAdapter(),
                            "jpaEventRegistryContext",
                            jpaEventPackagesToScan(),
                            dataSourceEvent()),
                    casProperties.getEvents().getJpa());

    return bean;
}
项目:cas-5.1.0    文件:GoogleAuthenticatorJpaConfiguration.java   
@Lazy
@Bean
public LocalContainerEntityManagerFactoryBean googleAuthenticatorEntityManagerFactory() {
    final LocalContainerEntityManagerFactoryBean bean =
            Beans.newHibernateEntityManagerFactoryBean(
                    new JpaConfigDataHolder(
                            jpaGoogleAuthenticatorVendorAdapter(),
                            "jpaGoogleAuthenticatorContext",
                            jpaPackagesToScanGoogleAuthenticator(),
                            dataSourceGoogleAuthenticator()),
                    casProperties.getAuthn().getMfa().getGauth().getJpa().getDatabase());

    return bean;
}
项目:cas-5.1.0    文件:CasSupportJdbcAuditConfiguration.java   
@Lazy
@Bean
public LocalContainerEntityManagerFactoryBean inspektrAuditEntityManagerFactory() {
    return Beans.newHibernateEntityManagerFactoryBean(
            new JpaConfigDataHolder(
                    Beans.newHibernateJpaVendorAdapter(casProperties.getJdbc()),
                    "jpaInspektrAuditContext",
                    new String[]{"org.apereo.cas.audit.entity"},
                    inspektrAuditTrailDataSource()),
            casProperties.getAudit().getJdbc());
}
项目:cas-5.1.0    文件:JdbcMultifactorAuthnTrustConfiguration.java   
@Lazy
@Bean
public LocalContainerEntityManagerFactoryBean mfaTrustedAuthnEntityManagerFactory() {
    final LocalContainerEntityManagerFactoryBean bean =
            Beans.newHibernateEntityManagerFactoryBean(
                    new JpaConfigDataHolder(
                            jpaMfaTrustedAuthnVendorAdapter(),
                            "jpaMfaTrustedAuthnContext",
                            jpaMfaTrustedAuthnPackagesToScan(),
                            dataSourceMfaTrustedAuthn()),
                    casProperties.getAuthn().getMfa().getTrusted().getJpa());

    return bean;
}
项目:cas-5.1.0    文件:JpaServiceRegistryConfiguration.java   
@Lazy
@Bean
public LocalContainerEntityManagerFactoryBean serviceEntityManagerFactory() {
    return newHibernateEntityManagerFactoryBean(
            new JpaConfigDataHolder(
                    jpaServiceVendorAdapter(),
                    "jpaServiceRegistryContext",
                    jpaServicePackagesToScan(),
                    dataSourceService()),
            casProperties.getServiceRegistry().getJpa());
}
项目:cas-5.1.0    文件:JpaTicketRegistryConfiguration.java   
@Lazy
@Bean
public LocalContainerEntityManagerFactoryBean ticketEntityManagerFactory() {
    return Beans.newHibernateEntityManagerFactoryBean(
            new JpaConfigDataHolder(
                    Beans.newHibernateJpaVendorAdapter(casProperties.getJdbc()),
                    "jpaTicketRegistryContext",
                    ticketPackagesToScan(),
                    dataSourceTicket()),
            casProperties.getTicket().getRegistry().getJpa());
}
项目:cas-5.1.0    文件:CasConsentJdbcConfiguration.java   
@Lazy
@Bean
public LocalContainerEntityManagerFactoryBean consentEntityManagerFactory() {
    final LocalContainerEntityManagerFactoryBean bean =
            Beans.newHibernateEntityManagerFactoryBean(
                    new JpaConfigDataHolder(
                            jpaConsentVendorAdapter(),
                            "jpaConsentContext",
                            jpaConsentPackagesToScan(),
                            dataSourceConsent()),
                    casProperties.getConsent().getJpa());
    return bean;
}
项目:cas-5.1.0    文件:Beans.java   
/**
 * New entity manager factory bean.
 *
 * @param config        the config
 * @param jpaProperties the jpa properties
 * @return the local container entity manager factory bean
 */
public static LocalContainerEntityManagerFactoryBean newHibernateEntityManagerFactoryBean(final JpaConfigDataHolder config,
                                                                                          final AbstractJpaProperties jpaProperties) {
    final LocalContainerEntityManagerFactoryBean bean = new LocalContainerEntityManagerFactoryBean();

    bean.setJpaVendorAdapter(config.getJpaVendorAdapter());

    if (StringUtils.isNotBlank(config.getPersistenceUnitName())) {
        bean.setPersistenceUnitName(config.getPersistenceUnitName());
    }
    bean.setPackagesToScan(config.getPackagesToScan());
    bean.setDataSource(config.getDataSource());

    final Properties properties = new Properties();
    properties.put("hibernate.dialect", jpaProperties.getDialect());
    properties.put("hibernate.hbm2ddl.auto", jpaProperties.getDdlAuto());
    properties.put("hibernate.jdbc.batch_size", jpaProperties.getBatchSize());
    if (StringUtils.isNotBlank(jpaProperties.getDefaultCatalog())) {
        properties.put("hibernate.default_catalog", jpaProperties.getDefaultCatalog());
    }
    if (StringUtils.isNotBlank(jpaProperties.getDefaultSchema())) {
        properties.put("hibernate.default_schema", jpaProperties.getDefaultSchema());
    }
    bean.setJpaProperties(properties);
    bean.getJpaPropertyMap().put("hibernate.enable_lazy_load_no_trans", Boolean.TRUE);
    return bean;
}
项目:easynetcn-cloud    文件:OneJpaConfig.java   
@Primary
@Bean(name = "oneEntityManagerFactory")
public LocalContainerEntityManagerFactoryBean entityManagerFactory(EntityManagerFactoryBuilder builder) {
    DataSource dataSource = dataSource();

    return builder.dataSource(dataSource).packages("com.easynetcn.cloud.one.web.data.entity")
            .persistenceUnit("onePersistenceUnit").build();
}
项目:spring-reactive-sample    文件:JpaConfig.java   
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory(DataSource dataSource) {
    LocalContainerEntityManagerFactoryBean emf = new LocalContainerEntityManagerFactoryBean();
    emf.setDataSource(dataSource);
    emf.setPackagesToScan(Post.class.getPackage().getName());
    emf.setPersistenceProvider(new HibernatePersistenceProvider());
    emf.setJpaProperties(jpaProperties());
    return emf;
}
项目:springboot_op    文件:UserDataSourceConfiguration.java   
@Bean(name = "entityManagerFactoryUser")
public LocalContainerEntityManagerFactoryBean entityManagerFactoryUser (EntityManagerFactoryBuilder builder) {
    return builder
            .dataSource(userDataSource)
            .properties(getVendorProperties(userDataSource))
            .packages(new String[]{ "com.myspringboot.repository.user", "com.myspringboot.entity" }) //设置应用userDataSource的基础包名
            .persistenceUnit("userPersistenceUnit")
            .build();
}
项目:springboot_op    文件:BookDataSourceConfiguration.java   
@Primary
@Bean(name = "entityManagerFactoryBook")
public LocalContainerEntityManagerFactoryBean entityManagerFactoryBook (EntityManagerFactoryBuilder builder) {
    return builder
            .dataSource(bookDataSource)
            .properties(getVendorProperties(bookDataSource))
            .packages(new String[]{"com.myspringboot.repository.book", "com.myspringboot.entity"}) //设置应用bookDataSource的基础包名
            .persistenceUnit("bookPersistenceUnit")
            .build();
}
项目:todo-list-webapp-angular2-spring-mvc-boot-data-rest    文件:PersistenceContext.java   
@Bean
LocalContainerEntityManagerFactoryBean entityManagerFactory(DataSource dataSource,
                                                            Environment env) {
    LocalContainerEntityManagerFactoryBean entityManagerFactoryBean = new LocalContainerEntityManagerFactoryBean();
    entityManagerFactoryBean.setDataSource(dataSource);
    entityManagerFactoryBean.setJpaVendorAdapter(new HibernateJpaVendorAdapter());
    entityManagerFactoryBean.setPackagesToScan("com.luke");

    Properties jpaProperties = new Properties();

    jpaProperties.put("hibernate.dialect", env.getRequiredProperty("hibernate.dialect"));

    jpaProperties.put("hibernate.hbm2ddl.auto",
            env.getRequiredProperty("hibernate.hbm2ddl.auto")
    );

    jpaProperties.put("hibernate.show_sql",
            env.getRequiredProperty("hibernate.show_sql")
    );

    jpaProperties.put("hibernate.format_sql",
            env.getRequiredProperty("hibernate.format_sql")
    );

    entityManagerFactoryBean.setJpaProperties(jpaProperties);

    return entityManagerFactoryBean;
}
项目:FHIR-CQL-ODM-service    文件:FhirServerTestConfigDstu3.java   
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
    LocalContainerEntityManagerFactoryBean retVal = new LocalContainerEntityManagerFactoryBean();
    //retVal.setPersistenceUnitManager(persistenceUnitManager());
    retVal.setMappingResources(orm);
    retVal.setPackagesToScan("org.partners.usciitg_prep.terminology.jpa");
    retVal.setPersistenceUnitName(persistenceUnitName);
    retVal.setDataSource(dataSource());
    retVal.setPersistenceProvider(new HibernatePersistenceProvider());      
    retVal.setJpaProperties(jpaProperties());
    return retVal;
}
项目:FHIR-CQL-ODM-service    文件:FhirServerTestConfigDstu3.java   
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
    LocalContainerEntityManagerFactoryBean retVal = new LocalContainerEntityManagerFactoryBean();
    //retVal.setPersistenceUnitManager(persistenceUnitManager());
    retVal.setMappingResources(orm);
    retVal.setPackagesToScan("org.partners.usciitg_prep.terminology.jpa");
    retVal.setPersistenceUnitName(persistenceUnitName);
    retVal.setDataSource(dataSource());
    retVal.setPersistenceProvider(new HibernatePersistenceProvider());      
    retVal.setJpaProperties(jpaProperties());
    return retVal;
}
项目:FHIR-CQL-ODM-service    文件:FhirServiceConfig.java   
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
    LocalContainerEntityManagerFactoryBean retVal = new LocalContainerEntityManagerFactoryBean();
    //retVal.setPersistenceUnitManager(persistenceUnitManager());
    retVal.setPackagesToScan(new String[]{"org.partners.usciitg_prep.terminology.jpa","org.partners.usciitg_prep.fhir.model"});
    retVal.setMappingResources(orm);
    retVal.setPersistenceUnitName(defaultPersistenceUnitName);
    retVal.setDataSource(dataSource());
    retVal.setPersistenceProvider(new HibernatePersistenceProvider());      
    retVal.setJpaProperties(jpaProperties());
    return retVal;
}
项目:FHIR-CQL-ODM-service    文件:FhirServiceTestConfig.java   
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
    LocalContainerEntityManagerFactoryBean retVal = new LocalContainerEntityManagerFactoryBean();
    //retVal.setPersistenceUnitManager(persistenceUnitManager());
    retVal.setPackagesToScan("org.partners.usciitg_prep.terminology.jpa","org.partners.usciitg_prep.fhir");     
    retVal.setMappingResources(orm);
    retVal.setPersistenceUnitName(defaultPersistenceUnitName);
    retVal.setDataSource(dataSource());
    retVal.setPersistenceProvider(new HibernatePersistenceProvider());      
    retVal.setJpaProperties(jpaProperties());
    return retVal;
}
项目:Spring-web-shop-project    文件:DataBaseConfiguration.java   
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
    LocalContainerEntityManagerFactoryBean factoryBean = new LocalContainerEntityManagerFactoryBean();
    factoryBean.setDataSource(dataSource());
    factoryBean.setPackagesToScan("com");
    factoryBean.setJpaVendorAdapter(new HibernateJpaVendorAdapter());
    factoryBean.setJpaProperties(getJpaProperties());
    return factoryBean;
}
项目:scrumtracker2017    文件:DBConfig.java   
@Bean
public EntityManagerFactory entityManagerFactory(DataSource dataSource, Properties dbProperties)
        throws SQLException {
    HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
    vendorAdapter.setGenerateDdl(true);
    LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean();
    factory.setJpaVendorAdapter(vendorAdapter);
    String dialect = dbProperties.getProperty("hibernateDialect");
    factory.getJpaPropertyMap().put("hibernate.dialect", dialect);
    factory.setPackagesToScan("hei2017.entity");
    factory.setDataSource(dataSource);
    factory.afterPropertiesSet();
    return factory.getObject();
}
项目:holon-datastore-jpa-querydsl    文件:TestJpaQueryDslDatastoreHibernate.java   
@Bean
public FactoryBean<EntityManagerFactory> entityManagerFactory() {
    LocalContainerEntityManagerFactoryBean emf = new LocalContainerEntityManagerFactoryBean();
    emf.setDataSource(dataSource());

    HibernateJpaVendorAdapter va = new HibernateJpaVendorAdapter();
    va.setShowSql(true);

    emf.setJpaVendorAdapter(va);

    emf.setPackagesToScan(TestJpaDomain.class.getPackage().getName());
    emf.setPersistenceUnitName("test");
    return emf;
}
项目:holon-datastore-jpa-querydsl    文件:TestJpaQueryDslDatastoreEclipselink.java   
@Bean
public FactoryBean<EntityManagerFactory> entityManagerFactory() {
    LocalContainerEntityManagerFactoryBean emf = new LocalContainerEntityManagerFactoryBean();
    emf.setDataSource(dataSource());

    emf.setJpaVendorAdapter(new EclipseLinkJpaVendorAdapter());

    emf.setPackagesToScan(TestJpaDomain.class.getPackage().getName());
    emf.setPersistenceUnitName("test");

    emf.getJpaPropertyMap().put("eclipselink.weaving", "false");
    return emf;
}
项目:spring-domain-events    文件:InfrastructureConfiguration.java   
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {

    HibernateJpaVendorAdapter adapter = new HibernateJpaVendorAdapter();
    adapter.setDatabase(Database.HSQL);
    adapter.setGenerateDdl(true);

    LocalContainerEntityManagerFactoryBean factoryBean = new LocalContainerEntityManagerFactoryBean();
    factoryBean.setDataSource(dataSource());
    factoryBean.setJpaVendorAdapter(adapter);
    factoryBean.setPackagesToScan(JpaEventPublicationConfiguration.class.getPackage().getName());

    return factoryBean;
}
项目:JenkinsHue    文件:CommonDBConfig.java   
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory(DataSource dataSource,
        JpaVendorAdapter jpaVendorAdapter) {
    LocalContainerEntityManagerFactoryBean lef = new LocalContainerEntityManagerFactoryBean();
    lef.setDataSource(dataSource);
    lef.setJpaVendorAdapter(jpaVendorAdapter);
    lef.setPackagesToScan("de.adesso.jenkinshue.entity");
    lef.setJpaProperties(dataSourceConfig.getJpaProperties());
    lef.afterPropertiesSet();
    return lef;
}
项目:spring-data-examples    文件:CustomerConfig.java   
@Bean
LocalContainerEntityManagerFactoryBean customerEntityManagerFactory() {

    HibernateJpaVendorAdapter jpaVendorAdapter = new HibernateJpaVendorAdapter();
    jpaVendorAdapter.setGenerateDdl(true);

    LocalContainerEntityManagerFactoryBean factoryBean = new LocalContainerEntityManagerFactoryBean();

    factoryBean.setDataSource(customerDataSource());
    factoryBean.setJpaVendorAdapter(jpaVendorAdapter);
    factoryBean.setPackagesToScan(CustomerConfig.class.getPackage().getName());

    return factoryBean;
}
项目:spring-data-examples    文件:OrderConfig.java   
@Bean
LocalContainerEntityManagerFactoryBean orderEntityManagerFactory() {

    HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
    vendorAdapter.setGenerateDdl(true);

    LocalContainerEntityManagerFactoryBean factoryBean = new LocalContainerEntityManagerFactoryBean();

    factoryBean.setDataSource(orderDataSource());
    factoryBean.setJpaVendorAdapter(vendorAdapter);
    factoryBean.setPackagesToScan(OrderConfig.class.getPackage().getName());

    return factoryBean;
}