Java 类org.hibernate.jpa.HibernatePersistenceProvider 实例源码

项目:trakxmap    文件:DB.java   
/**
 * fixes the warning (Encountered a deprecated javax.persistence.spi.PersistenceProvider [org.hibernate.ejb
 * .HibernatePersistence]; use [org.hibernate.jpa.HibernatePersistenceProvider] instead.)
 *
 * must be called before getting the EntityManagerFactory
 */
private static void fixDeprecatedHibernateWarning() {
    PersistenceProviderResolverHolder.setPersistenceProviderResolver(new PersistenceProviderResolver() {
        private final List<PersistenceProvider> providers_ =
                Arrays.asList(new PersistenceProvider[]{new HibernatePersistenceProvider()});

        @Override
        public List<PersistenceProvider> getPersistenceProviders() {
            return providers_;
        }

        @Override
        public void clearCachedProviders() {

        }
    });
}
项目: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();
}
项目:devops-cstack    文件:DatabaseConfigurationTest.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", true);
    jpaProperties.put("hibernate.show_sql", Boolean.parseBoolean(databaseShowSQL));
    lcemfb.setJpaProperties(jpaProperties);
    lcemfb.setPackagesToScan("cn.org.once.cstack.model");
    lcemfb.afterPropertiesSet();
    return lcemfb.getObject();
}
项目:Biliomi    文件:EntityManagerFactoryProducer.java   
private EntityManagerFactory setupH2EMF(String ddlMode) throws IOException {
  Map<String, Object> configuration = new HashMap<>();

  String jdbcUri = template("jdbc:h2:file:{{datapath}}/datastore")
      .add("datapath", BiliomiContainer.getParameters().getWorkingDir().getCanonicalPath())
      .apply();

  configuration.put("hibernate.connection.url", jdbcUri);
  configuration.put("hibernate.hbm2ddl.auto", ddlMode);

  // Add entity classes
  configuration.put(AvailableSettings.LOADED_CLASSES, scanForEntityClasses());

  // Create Entity manager factory
  logger.debug("Creating entity manager factory for local H2 database...");
  HibernatePersistenceProvider provider = new HibernatePersistenceProvider();
  return provider.createEntityManagerFactory("Biliomi-H2-DS", configuration);
}
项目: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();
}
项目:ktspring    文件:HibernateJPAConfig.java   
public static LocalContainerEntityManagerFactoryBean createEntityManagerFactory(JPAConfig config, List<JPAParams> jpaParamsList) {
    LocalContainerEntityManagerFactoryBean entityManager = new LocalContainerEntityManagerFactoryBean();
    if (config.isJtaDatasource()) {
        entityManager.setJtaDataSource(config.getDataSource());
    } else {
        entityManager.setDataSource(config.getDataSource());
    }
    Properties p = new Properties();
    p.putAll(config.getJpaProperties());
    if (jpaParamsList != null) {
        for (JPAParams jpaParams : jpaParamsList) {
            p.putAll(jpaParams.getProperties());
        }
    }
    entityManager.setJpaProperties(p);
    entityManager.setPackagesToScan(config.getPackageToScan());
    entityManager.setPersistenceProvider(new HibernatePersistenceProvider());
    return entityManager;
}
项目:high-performance-java-persistence    文件:AbstractJPAProgrammaticBootstrapTest.java   
@Before
public void init() {
    PersistenceUnitInfo persistenceUnitInfo = persistenceUnitInfo(getClass().getSimpleName());

    Map<String, Object> configuration = new HashMap<>();

    Integrator integrator = integrator();
    if (integrator != null) {
        configuration.put("hibernate.integrator_provider", (IntegratorProvider) () -> Collections.singletonList(integrator));
    }

    emf = new HibernatePersistenceProvider().createContainerEntityManagerFactory(
        persistenceUnitInfo,
        configuration
    );
}
项目:amigo-secreto    文件:PersistenceContext.java   
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() throws Exception {

    LocalContainerEntityManagerFactoryBean entityManagerFactoryBean = new LocalContainerEntityManagerFactoryBean();
    entityManagerFactoryBean.setDataSource(dataSource());
    entityManagerFactoryBean.setPackagesToScan(environment.getRequiredProperty(PROPERTY_NAME_ENTITYMANAGER_PACKAGES_TO_SCAN));
    entityManagerFactoryBean.setPersistenceProviderClass(HibernatePersistenceProvider.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));
    jpaProterties.put(PROPERTY_NAME_HIBERNATE_HBM2DDL, environment.getRequiredProperty(PROPERTY_NAME_HIBERNATE_HBM2DDL));

    entityManagerFactoryBean.setJpaProperties(jpaProterties);

    return entityManagerFactoryBean;
}
项目:SJPAReference    文件:PersistenceContext.java   
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() throws Exception {
    LocalContainerEntityManagerFactoryBean entityManagerFactoryBean = new LocalContainerEntityManagerFactoryBean();

    entityManagerFactoryBean.setDataSource(dataSource());
    entityManagerFactoryBean.setPackagesToScan(environment.getRequiredProperty(PROPERTY_NAME_ENTITYMANAGER_PACKAGES_TO_SCAN));
    entityManagerFactoryBean.setPersistenceProviderClass(HibernatePersistenceProvider.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));
    jpaProterties.put(PROPERTY_NAME_HIBERNATE_HBM2DDL, environment.getRequiredProperty(PROPERTY_NAME_HIBERNATE_HBM2DDL));;

    entityManagerFactoryBean.setJpaProperties(jpaProterties);

    return entityManagerFactoryBean;
}
项目:NickNack    文件:H2DatabaseConfiguration.java   
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() throws Exception {
    LocalContainerEntityManagerFactoryBean entityManagerFactoryBean = new LocalContainerEntityManagerFactoryBean();

    entityManagerFactoryBean.setDataSource(dataSource());
    entityManagerFactoryBean.setPackagesToScan("com.github.kmbulebu.nicknack.server.model");
    entityManagerFactoryBean.setPersistenceProviderClass(HibernatePersistenceProvider.class);


    Properties jpaProperties = new Properties();

    jpaProperties.put(PROPERTY_NAME_HIBERNATE_DIALECT, org.hibernate.dialect.H2Dialect.class.getName());
    jpaProperties.put(PROPERTY_NAME_HIBERNATE_FORMAT_SQL, "true");
    jpaProperties.put(PROPERTY_NAME_HIBERNATE_NAMING_STRATEGY, ImprovedNamingStrategy.class.getName());
    jpaProperties.put(PROPERTY_NAME_HIBERNATE_SHOW_SQL, "false");
    jpaProperties.put(PROPERTY_NAME_HIBERNATE_HBM2DDL_AUTO, "update");

    entityManagerFactoryBean.setJpaProperties(jpaProperties);

    return entityManagerFactoryBean;
}
项目:simplebank    文件:PersistenceConfig.java   
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() throws Exception {
    LocalContainerEntityManagerFactoryBean entityManagerFactoryBean = new LocalContainerEntityManagerFactoryBean();
    entityManagerFactoryBean.setDataSource(dataSource());
    entityManagerFactoryBean.setPackagesToScan(PROPERTY_NAME_ENTITYMANAGER_PACKAGES_TO_SCAN);
    entityManagerFactoryBean.setPersistenceProviderClass(HibernatePersistenceProvider.class);
    entityManagerFactoryBean.setJpaDialect(hibernateJpaDialect());

    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));
    jpaProterties.put(PROPERTY_NAME_HIBERNATE_HBM2DDL, environment.getRequiredProperty(PROPERTY_NAME_HIBERNATE_HBM2DDL));
    jpaProterties.put(PROPERTY_NAME_HIBERNATE_ENVERS_PREFIX, environment.getRequiredProperty(PROPERTY_NAME_HIBERNATE_ENVERS_PREFIX));
    jpaProterties.put(PROPERTY_NAME_HIBERNATE_ENVERS_SUFFIX, environment.getRequiredProperty(PROPERTY_NAME_HIBERNATE_ENVERS_SUFFIX));
    entityManagerFactoryBean.setJpaProperties(jpaProterties);
    return entityManagerFactoryBean;
}
项目:rapidoid    文件:RapidoidThingsTest.java   
@Test
public void classesShouldExtendRapidoidThing() {
    for (String cls : Cls.getRapidoidClasses()) {

        if (cls.startsWith("org.rapidoid.plugin.app.")
            || cls.startsWith("org.rapidoid.fluent.")
            || cls.startsWith("org.rapidoid.benchmark.")) continue;

        Class<?> clazz = Cls.get(cls);

        if (!clazz.isInterface() && !clazz.isEnum() && !clazz.isAnnotation()) {
            U.must(RapidoidThing.class.isAssignableFrom(clazz)
                || clazz == TestCommons.class
                || Exception.class.isAssignableFrom(clazz)
                || ClassLoader.class.isAssignableFrom(clazz)
                || HibernatePersistenceProvider.class.isAssignableFrom(clazz)
                || OutputStream.class.isAssignableFrom(clazz)
                || Map.class.isAssignableFrom(clazz)
                || JsonSerializer.class.isAssignableFrom(clazz)
                || JsonDeserializer.class.isAssignableFrom(clazz)
                || LogFactory.class.isAssignableFrom(clazz)
                || Thread.class.isAssignableFrom(clazz), "" + cls);
        }
    }
}
项目:lightmare    文件:JpaManager.java   
/**
 * Creates {@link EntityManagerFactory} by
 * <a href="http://hibernate.org">"Hibernate"</a> or by extended builder
 * {@link Ejb3ConfigurationImpl} if entity classes or persistence.xml file
 * path are provided
 *
 * @see Ejb3ConfigurationImpl#configure(String, Map) and
 *      Ejb3ConfigurationImpl#createEntityManagerFactory()
 *
 * @param unitName
 * @return {@link EntityManagerFactory}
 */
private EntityManagerFactory buildEntityManagerFactory(String unitName) throws IOException {

    EntityManagerFactory emf;

    HibernatePersistenceProvider provider;
    HibernatePersistenceProviderExt.Builder builder = new HibernatePersistenceProviderExt.Builder();
    configureProvider(builder);
    provider = builder.build();
    configureTransactionManager();
    // Adds JNDI properties
    addJndiProperties();
    if (springPersistence) {
        emf = getFromSpring(provider, unitName);
    } else {
        emf = provider.createEntityManagerFactory(unitName, properties);
    }

    return emf;
}
项目: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;
}
项目: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;
}
项目:DHIS2-fhir-lab-app    文件:FhirServerConfigDstu3.java   
@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());
    return retVal;
}
项目:DHIS2-fhir-lab-app    文件:FhirServerConfig.java   
@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());
    return retVal;
}
项目:Sound.je    文件:DatabaseConfig.java   
/**
 * Create new EntityManagerFactory
 *
 * @param dataSource          the data source
 * @param hibernateProperties the hibernate properties
 * @return the entity manager factory
 */
@Bean
public EntityManagerFactory entityManagerFactory(final DataSource dataSource, final Properties hibernateProperties) {
    final LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean();
    em.setDataSource(dataSource);
    em.setPackagesToScan(entitymanagerPackagesToScan);
    em.setJpaVendorAdapter(new HibernateJpaVendorAdapter());
    em.setJpaProperties(hibernateProperties);
    em.setPersistenceUnitName("nestedbird");
    em.setSharedCacheMode(SharedCacheMode.ENABLE_SELECTIVE);
    em.setPersistenceProviderClass(HibernatePersistenceProvider.class);
    em.afterPropertiesSet();

    return em.getObject();
}
项目:Biliomi    文件:EntityManagerFactoryProducer.java   
private EntityManagerFactory setupMySQLEMF(String ddlMode) {
  Map<String, Object> configuration = new HashMap<>();
  USMySQL mySQL = yamlCoreSettings.getBiliomi().getDatabase().getMySQL();
  boolean useSSL = mySQL.isUsessl();

  // Biliomi doesn't need the MySQL server to be in the correct timezone since all dates
  // are persisted as ISO8601, but a server might stall connection if this isn't set.
  TimeZone timeZone = Calendar.getInstance().getTimeZone();
  configuration.put("hibernate.connection.serverTimezone", timeZone.getID());

  String jdbcUri = template("jdbc:mysql://{{host}}:{{port}}/{{database}}")
      .add("host", mySQL::getHost)
      .add("port", mySQL::getPort)
      .add("database", mySQL::getDatabase)
      .apply();

  configuration.put("hibernate.connection.url", jdbcUri);
  configuration.put("hibernate.connection.username", mySQL.getUsername());
  configuration.put("hibernate.connection.password", mySQL.getPassword());
  configuration.put("hibernate.connection.useSSL", String.valueOf(useSSL));
  configuration.put("hibernate.hbm2ddl.auto", ddlMode);

  // Add entity classes
  configuration.put(AvailableSettings.LOADED_CLASSES, scanForEntityClasses());

  // Create Entity manager factory
  logger.debug("Creating entity manager factory for MySQL database...");
  HibernatePersistenceProvider provider = new HibernatePersistenceProvider();
  return provider.createEntityManagerFactory("Biliomi-MySQL-DS", configuration);
}
项目:spring-rest-sample    文件:JpaConfig.java   
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
    LocalContainerEntityManagerFactoryBean emf = new LocalContainerEntityManagerFactoryBean();
    emf.setDataSource(dataSource);
    emf.setPackagesToScan(Constants.BASE_PACKAGE);
    emf.setPersistenceProvider(new HibernatePersistenceProvider());
    emf.setJpaProperties(jpaProperties());
    return emf;
}
项目:OperatieBRP    文件:RepositoryConfiguratie.java   
/**
 * @return entity manager factory (kern; alleen lezen)
 */
@Bean(name = ENTITY_MANAGER_KERN)
@DependsOn(TRANSACTION_MANAGER)
public LocalContainerEntityManagerFactoryBean kernEntityManagerFactory() {
    final LocalContainerEntityManagerFactoryBean entityManagerFactoryBean = new LocalContainerEntityManagerFactoryBean();
    entityManagerFactoryBean.setDataSource(kernDataSource());
    entityManagerFactoryBean.setPersistenceUnitName(PERSISTENCE_UNIT_KERN);
    entityManagerFactoryBean.setPersistenceProviderClass(HibernatePersistenceProvider.class);
    entityManagerFactoryBean.setPackagesToScan(PACKAGE_USERTYPES, PACKAGE_STAMGEGEVEN_ENTITY, PACKAGE_BEHEER_VIEW);

    entityManagerFactoryBean.setJpaProperties(hibernateProperties());

    return entityManagerFactoryBean;
}
项目:OperatieBRP    文件:RepositoryConfiguratie.java   
/**
 * @return entity manager factory (kern; schrijven)
 */
@Bean(name = ENTITY_MANAGER_MASTER)
@DependsOn(TRANSACTION_MANAGER)
public LocalContainerEntityManagerFactoryBean masterEntityManagerFactory() {
    final LocalContainerEntityManagerFactoryBean entityManagerFactoryBean = new LocalContainerEntityManagerFactoryBean();
    entityManagerFactoryBean.setDataSource(masterDataSource());
    entityManagerFactoryBean.setPersistenceUnitName(PERSISTENCE_UNIT_MASTER);
    entityManagerFactoryBean.setPersistenceProviderClass(HibernatePersistenceProvider.class);
    entityManagerFactoryBean.setPackagesToScan(PACKAGE_USERTYPES, PACKAGE_STAMGEGEVEN_ENTITY, PACKAGE_BEHEER_VIEW);
    entityManagerFactoryBean.setJpaProperties(hibernateProperties());

    return entityManagerFactoryBean;
}
项目:OperatieBRP    文件:RepositoryConfiguratie.java   
/**
 * @return entity manager factory (archivering; alleen lezen)
 */
@Bean(name = ENTITY_MANAGER_ARCHIVERING)
@DependsOn(TRANSACTION_MANAGER)
public LocalContainerEntityManagerFactoryBean archiveringEntityManagerFactory() {
    final LocalContainerEntityManagerFactoryBean entityManagerFactoryBean = new LocalContainerEntityManagerFactoryBean();
    entityManagerFactoryBean.setDataSource(archiveringDataSource());
    entityManagerFactoryBean.setPersistenceUnitName(PERSISTENCE_UNIT_ARCHIVERING);
    entityManagerFactoryBean.setPersistenceProviderClass(HibernatePersistenceProvider.class);
    entityManagerFactoryBean.setPackagesToScan(PACKAGE_USERTYPES, PACKAGE_STAMGEGEVEN_ENTITY, PACKAGE_BEHEER_VIEW);

    entityManagerFactoryBean.setJpaProperties(hibernateProperties());

    return entityManagerFactoryBean;
}
项目:OperatieBRP    文件:RepositoryConfiguratie.java   
/**
 * @return entity manager factory (protocollering; alleen lezen)
 */
@Bean(name = ENTITY_MANAGER_PROTOCOLLERING)
@DependsOn(TRANSACTION_MANAGER)
public LocalContainerEntityManagerFactoryBean protocolleringEntityManagerFactory() {
    final LocalContainerEntityManagerFactoryBean entityManagerFactoryBean = new LocalContainerEntityManagerFactoryBean();
    entityManagerFactoryBean.setDataSource(protocolleringDataSource());
    entityManagerFactoryBean.setPersistenceUnitName(PERSISTENCE_UNIT_PROTOCOLLERING);
    entityManagerFactoryBean.setPersistenceProviderClass(HibernatePersistenceProvider.class);
    entityManagerFactoryBean.setPackagesToScan(PACKAGE_STAMGEGEVEN_ENTITY, PACKAGE_BEHEER_VIEW);

    entityManagerFactoryBean.setJpaProperties(hibernateProperties());

    return entityManagerFactoryBean;
}
项目:vertx-jpa    文件:HibernateEntityManagerFactoryProvider.java   
@Override
public Future<EntityManagerFactory> getEntityManagerFactory(String datasourceName) {

  Properties properties = createProperties();

  PersistenceProvider provider = new HibernatePersistenceProvider();

  SmartPersistanceUnitInfo persistenceUnitInfo = new DefaultPersistenceUnitInfoImpl(datasourceName);
  persistenceUnitInfo.setProperties(properties);

  // Using RESOURCE_LOCAL for manage transactions on DAO side.
  persistenceUnitInfo.setTransactionType(PersistenceUnitTransactionType.RESOURCE_LOCAL);

  Map<Object, Object> configuration = new HashMap<>();
  properties.entrySet().stream().forEach(e -> configuration.put(e.getKey(), e.getValue()));

  synchronized (vertx) {

    Future<EntityManagerFactory> future = Future.future();
    vertx.executeBlocking(f1 -> {

      config.getJsonArray("annotated_classes", new JsonArray()).stream()
          .forEach(p -> scanAnnotatedClasses(p.toString(), persistenceUnitInfo));
      EntityManagerFactory emf = provider.createContainerEntityManagerFactory(persistenceUnitInfo, configuration);
      future.complete(emf);
    }, future.completer());
    return future;
  }
}
项目:BCDS    文件:DatabaseConfiguration.java   
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
    LocalContainerEntityManagerFactoryBean entityManagerFactoryBean = new LocalContainerEntityManagerFactoryBean();
    entityManagerFactoryBean.setDataSource(dataSource());
    entityManagerFactoryBean.setPersistenceProviderClass(HibernatePersistenceProvider.class);
    entityManagerFactoryBean.setPackagesToScan("gov.va.vba.persistence.entity");
    entityManagerFactoryBean.setJpaProperties(hibernateProperties());
    return entityManagerFactoryBean;
}
项目:isc-hapi-fhir-jpaserver    文件:FhirServerConfig.java   
@Bean()
public LocalContainerEntityManagerFactoryBean entityManagerFactory() throws SQLException {
    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());
    return retVal;
}
项目:jspare-container    文件:PersistenceUnitProviderImpl.java   
@Override
public void create(String datasourceName, PersistenceOptions config) {
  LocalContainerEntityManagerFactoryBean emf = new LocalContainerEntityManagerFactoryBean();
  emf.setJpaVendorAdapter(new HibernateJpaVendorAdapter());
  emf.setJpaProperties(createProperties(config));
  emf.setDataSource(getDataSource(datasourceName, config));
  emf.setPersistenceUnitName(datasourceName);
  emf.setPersistenceProvider(new HibernatePersistenceProvider());
  emf.setPackagesToScan(config.getAnnotatedClasses().toArray(new String[]{}));
  emf.afterPropertiesSet();

  providers.put(datasourceName, emf.getObject());
}
项目:cqf-ruler    文件:FhirServerConfigDstu3.java   
@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());
    return retVal;
}
项目:report-cockpit-birt-web    文件:DatabaseConfig.java   
@Bean
public LocalContainerEntityManagerFactoryBean reportcockpitEntityManagerFactory() {
    LocalContainerEntityManagerFactoryBean entityManagerFactory = new LocalContainerEntityManagerFactoryBean();
    entityManagerFactory.setDataSource(reportcockpitDataSource());
    entityManagerFactory.setPersistenceProviderClass(
            HibernatePersistenceProvider.class);
    entityManagerFactory.setPackagesToScan("de.interseroh.report.auth");
    entityManagerFactory
            .setJpaProperties(reportcockpitHibernateProperties());
    entityManagerFactory
            .setPersistenceUnitName("reportcockpitPersistenceUnit");

    return entityManagerFactory;
}
项目:fhirstarters    文件:FhirServerConfigDstu3.java   
@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());
    return retVal;
}
项目:high-performance-java-persistence    文件:JPATransactionManagerConfiguration.java   
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
    LocalContainerEntityManagerFactoryBean localContainerEntityManagerFactoryBean = new LocalContainerEntityManagerFactoryBean();
    localContainerEntityManagerFactoryBean.setPersistenceUnitName(getClass().getSimpleName());
    localContainerEntityManagerFactoryBean.setPersistenceProvider(new HibernatePersistenceProvider());
    localContainerEntityManagerFactoryBean.setDataSource(dataSource());
    localContainerEntityManagerFactoryBean.setPackagesToScan(packagesToScan());

    JpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
    localContainerEntityManagerFactoryBean.setJpaVendorAdapter(vendorAdapter);
    localContainerEntityManagerFactoryBean.setJpaProperties(additionalProperties());
    return localContainerEntityManagerFactoryBean;
}
项目:high-performance-java-persistence    文件:JTATransactionManagerConfiguration.java   
@Bean
@DependsOn("btmConfig")
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
    LocalContainerEntityManagerFactoryBean localContainerEntityManagerFactoryBean = new LocalContainerEntityManagerFactoryBean();
    localContainerEntityManagerFactoryBean.setPersistenceUnitName(getClass().getSimpleName());
    localContainerEntityManagerFactoryBean.setPersistenceProvider(new HibernatePersistenceProvider());
    localContainerEntityManagerFactoryBean.setDataSource(dataSource());
    localContainerEntityManagerFactoryBean.setPackagesToScan(packagesToScan());

    JpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
    localContainerEntityManagerFactoryBean.setJpaVendorAdapter(vendorAdapter);
    localContainerEntityManagerFactoryBean.setJpaProperties(additionalProperties());
    return localContainerEntityManagerFactoryBean;
}
项目:high-performance-java-persistence    文件:BehaviorDrivenInheritanceConfiguration.java   
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
    LocalContainerEntityManagerFactoryBean localContainerEntityManagerFactoryBean = new LocalContainerEntityManagerFactoryBean();
    localContainerEntityManagerFactoryBean.setPersistenceUnitName( getClass().getSimpleName() );
    localContainerEntityManagerFactoryBean.setPersistenceProvider( new HibernatePersistenceProvider() );
    localContainerEntityManagerFactoryBean.setDataSource( dataSource() );
    localContainerEntityManagerFactoryBean.setPackagesToScan( packagesToScan() );

    JpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
    localContainerEntityManagerFactoryBean.setJpaVendorAdapter( vendorAdapter );
    localContainerEntityManagerFactoryBean.setJpaProperties( additionalProperties() );
    return localContainerEntityManagerFactoryBean;
}
项目:high-performance-java-persistence    文件:AbstractJPAConfiguration.java   
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
    LocalContainerEntityManagerFactoryBean localContainerEntityManagerFactoryBean = new LocalContainerEntityManagerFactoryBean();
    localContainerEntityManagerFactoryBean.setPersistenceUnitName(getClass().getSimpleName());
    localContainerEntityManagerFactoryBean.setPersistenceProvider(new HibernatePersistenceProvider());
    localContainerEntityManagerFactoryBean.setDataSource(dataSource());
    localContainerEntityManagerFactoryBean.setPackagesToScan(packagesToScan());

    JpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
    localContainerEntityManagerFactoryBean.setJpaVendorAdapter(vendorAdapter);
    localContainerEntityManagerFactoryBean.setJpaProperties(additionalProperties());
    return localContainerEntityManagerFactoryBean;
}
项目:high-performance-java-persistence    文件:AbstractFlywayConfiguration.java   
@Bean @DependsOn("flyway")
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
    LocalContainerEntityManagerFactoryBean localContainerEntityManagerFactoryBean = new LocalContainerEntityManagerFactoryBean();
    localContainerEntityManagerFactoryBean.setPersistenceUnitName(getClass().getSimpleName());
    localContainerEntityManagerFactoryBean.setPersistenceProvider(new HibernatePersistenceProvider());
    localContainerEntityManagerFactoryBean.setDataSource(actualDataSource());
    localContainerEntityManagerFactoryBean.setPackagesToScan(packagesToScan());

    JpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
    localContainerEntityManagerFactoryBean.setJpaVendorAdapter(vendorAdapter);
    localContainerEntityManagerFactoryBean.setJpaProperties(additionalProperties());
    return localContainerEntityManagerFactoryBean;
}
项目:dropwizard-entitymanager    文件:EntityManagerFactoryFactory.java   
private EntityManagerFactory buildSessionFactory(EntityManagerBundle<?> bundle,
                                                 PooledDataSourceFactory dbConfig,
                                                 ManagedDataSource dataSource,
                                                 Map<String, String> properties,
                                                 List<Class<?>> entities) {

    PersistenceUnitInfoImpl persistenceUnitInfo = new PersistenceUnitInfoImpl(bundle.name(), dataSource);

    persistenceUnitInfo.setProperty(AvailableSettings.CURRENT_SESSION_CONTEXT_CLASS, "managed");
    persistenceUnitInfo.setProperty(AvailableSettings.USE_SQL_COMMENTS,
            Boolean.toString(dbConfig.isAutoCommentsEnabled()));
    persistenceUnitInfo.setProperty(AvailableSettings.USE_GET_GENERATED_KEYS, "true");
    persistenceUnitInfo.setProperty(AvailableSettings.GENERATE_STATISTICS, "true");
    persistenceUnitInfo.setProperty(AvailableSettings.USE_REFLECTION_OPTIMIZER, "true");
    persistenceUnitInfo.setProperty(AvailableSettings.ORDER_UPDATES, "true");
    persistenceUnitInfo.setProperty(AvailableSettings.ORDER_INSERTS, "true");
    persistenceUnitInfo.setProperty(AvailableSettings.USE_NEW_ID_GENERATOR_MAPPINGS, "true");
    persistenceUnitInfo.setProperty("jadira.usertype.autoRegisterUserTypes", "true");
    for (Map.Entry<String, String> property : properties.entrySet()) {
        persistenceUnitInfo.setProperty(property.getKey(), property.getValue());
    }

    addAnnotatedClasses(persistenceUnitInfo, entities);
    bundle.configure(persistenceUnitInfo);

    configure(persistenceUnitInfo);

    return new HibernatePersistenceProvider().createContainerEntityManagerFactory(persistenceUnitInfo, null);
}