Java 类org.springframework.boot.autoconfigure.orm.jpa.EntityManagerFactoryBuilder 实例源码

项目:github-job-keywords    文件:LiquibaseJobDatabaseConfiguration.java   
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory(EntityManagerFactoryBuilder entityBuilder) {
    // .persistenceUnit("default").build();
    Map<String, String> jpaProperties = new HashMap<>();
    jpaProperties.put("hibernate.hbm2ddl.auto", "");
    jpaProperties.put("hibernate.ejb.naming_strategy",
        "org.springframework.boot.orm.jpa.hibernate.SpringNamingStrategy");

    Builder builder = entityBuilder.dataSource(dataSource);
    builder.jta(false);
    builder = builder.packages("com.aestheticsw.jobkeywords.service.termextractor.domain");
    builder.persistenceUnit("jobkeywords");
    builder = builder.properties(jpaProperties);
    LocalContainerEntityManagerFactoryBean factoryBean = builder.build();
    return factoryBean;
}
项目:github-job-keywords    文件:LiquibaseHbm2ddlDatabaseConfiguration.java   
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory(EntityManagerFactoryBuilder entityBuilder) {
    Map<String, String> jpaProperties = new HashMap<>();
    // this insures that the DB will always be recreated 
    jpaProperties.put("hibernate.hbm2ddl.auto", "create-drop");
    jpaProperties.put("hibernate.ejb.naming_strategy",
        "org.springframework.boot.orm.jpa.hibernate.SpringNamingStrategy");

    Builder builder = entityBuilder.dataSource(hbm2ddlDataSource);
    builder.jta(false);
    builder = builder.packages("com.aestheticsw.jobkeywords.service.termextractor.domain");
    builder.persistenceUnit("hbm2ddl");
    builder = builder.properties(jpaProperties);
    LocalContainerEntityManagerFactoryBean factoryBean = builder.build();
    return factoryBean;
}
项目:multitenancy    文件:MultitenancyConfig.java   
@Bean
    public LocalContainerEntityManagerFactoryBean metaEntityManager(EntityManagerFactoryBuilder builder,
                                                                    @Qualifier("metaDataSource") DataSource dataSource) {
        Map<String, Object> props = new HashMap<>();
        props.putAll(jpaProps.getSubProperties("properties."));
//        props.put("hibernate.hbm2ddl.auto", "create");

        LocalContainerEntityManagerFactoryBean factory = builder.dataSource(dataSource)
            .jta(true)
            .persistenceUnit("metaPU")
            .packages("de.weichert.multitenancy")
            .properties(props)
            .build();
        factory.setJpaVendorAdapter(new HibernateJpaVendorAdapter());
        factory.setJpaDialect(new HibernateJpaDialect());
        return factory;
    }
项目:example-ddd-with-spring-data-jpa    文件:JpaConfiguration.java   
@Bean
public EntityManagerFactoryBuilder entityManagerFactoryBuilder() {
    EntityManagerFactoryBuilder builder = new EntityManagerFactoryBuilder(jpaVendorAdapter(), jpaProperties(), null);
    return builder;
}