Java 类org.springframework.orm.jpa.vendor.Database 实例源码

项目:b4    文件:B4CoreRootConfig.java   
@Bean
public EntityManagerFactory entityManagerFactory() {
    HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
    vendorAdapter.setDatabase(Database.H2);
    vendorAdapter.setGenerateDdl(jpaGenerateDdl);
    vendorAdapter.setShowSql(jpaShowSql);

    LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean();
    factory.setJpaVendorAdapter(vendorAdapter);
    factory.setPackagesToScan("org.bricket.b4.*.entity");
    factory.setDataSource(dataSource());
    factory.setJpaDialect(jpaDialect());

    Map<String, String> jpaProperties = new HashMap<String, String>();
    jpaProperties.put("hibernate.dialect", H2Dialect.class.getName());
    jpaProperties.put("hibernate.cache.region.factory_class", EhCacheRegionFactory.class.getName());
    jpaProperties.put("hibernate.cache.use_second_level_cache", "true");
    jpaProperties.put("hibernate.cache.use_query_cache", "true");
    jpaProperties.put("hibernate.cache.use_minimal_puts", "true");
    factory.setJpaPropertyMap(jpaProperties);

    factory.afterPropertiesSet();

    return factory.getObject();
}
项目:tasfe-framework    文件:JPAUtil.java   
/**
 * 获取数据库类型
 */
public static Database getDBType(DataSource dataSource){
    String jdbcUrl = getJdbcUrlFromDataSource(dataSource);

    if (StringUtils.contains(jdbcUrl, ":h2:")) {
        return Database.H2 ;
    } else if (StringUtils.contains(jdbcUrl, ":mysql:")) {
        return Database.MYSQL ;
    } else if (StringUtils.contains(jdbcUrl, ":oracle:")) {
        return Database.ORACLE ;
    } else if (StringUtils.contains(jdbcUrl, ":postgresql:")) {
        return Database.POSTGRESQL ;
    } else if (StringUtils.contains(jdbcUrl, ":sqlserver:")) {
        return Database.SQL_SERVER ;
    }
    throw new IllegalArgumentException("Unknown Database of " + jdbcUrl);
}
项目: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();
}
项目: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;
}
项目: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();
}
项目:jdblender    文件:Config.java   
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {

    HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
    vendorAdapter.setGenerateDdl(false);
    vendorAdapter.setDatabase(Database.H2);
    vendorAdapter.setShowSql(false);

    LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean();
    factory.setJpaVendorAdapter(vendorAdapter);
    factory.setPackagesToScan("jdblender.sdata.model");
    factory.setDataSource(dataSourceH2());
    Map<String, Object> props = factory.getJpaPropertyMap();
    props.put("hibernate.cache.use_query_cache", "false");
    props.put("hibernate.cache.use_second_level_cache", "false");
    props.put("hibernate.hbm2ddl.auto", "validate");
    //props.put("hibernate.jdbc.batch_size", "100");
    //props.put("hibernate.cache.use_second_level_cache", "false");
    //props.put("hibernate.order_inserts", "1");
    //props.put("hibernate.order_updates", "1");

    factory.setJpaPropertyMap(props);

    return factory;
}
项目:spring-content    文件:JpaInfrastructureConfig.java   
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {

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

    LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean();
    factory.setJpaVendorAdapter(vendorAdapter);
    factory.setPackagesToScan(packagesToScan());
    factory.setPersistenceUnitName("spring-data-rest-webmvc");
    factory.setDataSource(dataSource());
    factory.afterPropertiesSet();

    return factory;
}
项目:genericdao    文件:JPAUtil.java   
/**
 * 获取数据库类型
 */
public static Database getDBType(DataSource dataSource){
    String jdbcUrl = getJdbcUrlFromDataSource(dataSource);

    if (StringUtils.contains(jdbcUrl, ":h2:")) {
        return Database.H2 ;
    } else if (StringUtils.contains(jdbcUrl, ":mysql:")) {
        return Database.MYSQL ;
    } else if (StringUtils.contains(jdbcUrl, ":oracle:")) {
        return Database.ORACLE ;
    } else if (StringUtils.contains(jdbcUrl, ":postgresql:")) {
        return Database.POSTGRESQL ;
    } else if (StringUtils.contains(jdbcUrl, ":sqlserver:")) {
        return Database.SQL_SERVER ;
    }
    throw new IllegalArgumentException("Unknown Database of " + jdbcUrl);
}
项目:herd    文件:DaoSpringModuleConfig.java   
/**
 * Gets the Hibernate JPA vendor adapter needed by the entity manager.
 *
 * @return the Hibernate JPA vendor adapter.
 */
private JpaVendorAdapter getHibernateJpaVendorAdapter()
{
    HibernateJpaVendorAdapter hibernateJpaVendorAdapter = new HibernateJpaVendorAdapter();
    // Set the database type.
    String databaseType = configurationHelper.getProperty(ConfigurationValue.DATABASE_TYPE);
    if (StringUtils.isBlank(databaseType))
    {
        throw new IllegalStateException(
            String.format("No database type found. Ensure the \"%s\" configuration entry is configured.", ConfigurationValue.DATABASE_TYPE.getKey()));
    }
    Database database = Database.valueOf(databaseType);
    LOGGER.info("jpaTargetDatabase={}", database);
    hibernateJpaVendorAdapter.setDatabase(database);
    hibernateJpaVendorAdapter.setGenerateDdl(false);
    return hibernateJpaVendorAdapter;
}
项目:spring-agora-web    文件:ApplicationConfig.java   
@Bean
@Autowired
public EntityManagerFactory entityManagerFactory(DataSource dataSource)  
{
    HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
    vendorAdapter.setGenerateDdl(generateDDL.booleanValue());
    vendorAdapter.setShowSql(showSQL.booleanValue());
    vendorAdapter.setDatabasePlatform("org.hibernate.dialect.MySQL5InnoDBDialect");
    vendorAdapter.setDatabase(Database.MYSQL);

    Properties properties = new Properties();
    properties.setProperty("hibernate.cache.use_second_level_cache", "true");
    properties.setProperty("hibernate.cache.region.factory_class", "org.hibernate.cache.ehcache.EhCacheRegionFactory");
    properties.setProperty("hibernate.cache.use_query_cache", "true");
    properties.setProperty("hibernate.generate_statistics", showStatistics.toString());

    LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean();
    factory.setJpaVendorAdapter(vendorAdapter);
    factory.setPackagesToScan("io.springagora.core.domain");
    factory.setDataSource(dataSource);
    factory.setJpaProperties(properties);
    factory.afterPropertiesSet();

    return factory.getObject();
}
项目:bjug-querydsl    文件:JpaConfig.java   
@Bean(name="entityManagerFactory")
public EntityManagerFactory entityManagerFactory() {
    HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
    vendorAdapter.setDatabase(Database.H2);
    vendorAdapter.setGenerateDdl(false);
    vendorAdapter.setShowSql(true);

    LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean();
    factory.setJpaVendorAdapter(vendorAdapter);
    factory.setPackagesToScan("net.eusashead.bjugquerydsl.data");
    factory.setDataSource(dataSource());

    factory.afterPropertiesSet();

    return factory.getObject();
}
项目: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    文件:H2DBConfig.java   
@Bean
public JpaVendorAdapter jpaVendorAdapter() {
    HibernateJpaVendorAdapter hibernateJpaVendorAdapter = new HibernateJpaVendorAdapter();
    hibernateJpaVendorAdapter.setShowSql(true);
    hibernateJpaVendorAdapter.setGenerateDdl(true);
    hibernateJpaVendorAdapter.setDatabase(Database.H2);
    return hibernateJpaVendorAdapter;
}
项目:JenkinsHue    文件:PostgreSQLDBConfig.java   
@Bean
public JpaVendorAdapter jpaVendorAdapter() {
    HibernateJpaVendorAdapter hibernateJpaVendorAdapter = new HibernateJpaVendorAdapter();
    hibernateJpaVendorAdapter.setShowSql(sql);
    hibernateJpaVendorAdapter.setGenerateDdl(sql);
    hibernateJpaVendorAdapter.setDatabase(Database.POSTGRESQL);
    return hibernateJpaVendorAdapter;
}
项目:Your-Microservice    文件:YourMicroserviceEnvironmentConfiguration.java   
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
    HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
    vendorAdapter.setDatabase(Database.H2);
    vendorAdapter.setGenerateDdl(true);

    LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean();
    factory.setJpaVendorAdapter(vendorAdapter);
    factory.setPackagesToScan("your.microservice.core.security.idp.model.base");
    factory.setDataSource(dataSource());

    return factory;
}
项目:social-media-analytic-system    文件:DataSourceConfig.java   
/**
 * JPA vendor adapter provides specifics about particular JPA implementation to use
 * @return JPA vendor adapter
 */
@Bean
public JpaVendorAdapter jpaVendorAdapter(Environment env){
    HibernateJpaVendorAdapter adapter = new HibernateJpaVendorAdapter();
    adapter.setDatabase(Database.POSTGRESQL);
    adapter.setShowSql(Boolean.parseBoolean(env.getProperty(PROPERTY_JPA_SHOW_SQL)));
    adapter.setDatabasePlatform(env.getProperty(PROPERTY_JPA_DATABASE_PLATFORM));
    adapter.setGenerateDdl(Boolean.parseBoolean(env.getProperty(PROPERTY_JPA_GENERATE_DDL)));
    return adapter;
}
项目:dev-courses    文件:DomainAndPersitenceConfigManuelle.java   
@Bean
public JpaVendorAdapter jpaVendorAdapter() {
    HibernateJpaVendorAdapter hibernateJpaVendorAdapter = new HibernateJpaVendorAdapter();
    hibernateJpaVendorAdapter.setShowSql(false);
    hibernateJpaVendorAdapter.setGenerateDdl(false);
    hibernateJpaVendorAdapter.setDatabase(Database.H2);
    return hibernateJpaVendorAdapter;
}
项目:dev-courses    文件:Config.java   
@Bean
public JpaVendorAdapter jpaVendorAdapter() {
    HibernateJpaVendorAdapter hibernateJpaVendorAdapter = new HibernateJpaVendorAdapter();
    hibernateJpaVendorAdapter.setShowSql(false);
    hibernateJpaVendorAdapter.setGenerateDdl(true);
    hibernateJpaVendorAdapter.setDatabase(Database.H2);
    return hibernateJpaVendorAdapter;
}
项目:exampp    文件:JPAConfig.java   
@Bean
public EntityManagerFactory entityManagerFactory() {
    HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
    vendorAdapter.setDatabase(Database.POSTGRESQL);
    vendorAdapter.setGenerateDdl(generateDDL);
    vendorAdapter.setShowSql(true);

    LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean();
    factory.setJpaVendorAdapter(vendorAdapter);
    factory.setPackagesToScan("ro.dutylabs.mpp.core.model");
    factory.setDataSource(dataSource());
    factory.afterPropertiesSet();
    return factory.getObject();
}
项目:holon-datastore-jpa    文件:EntityManagerFactoryConfigurator.java   
private static Database convertToSpringVendor(DatabasePlatform database) {
    switch (database) {
    case DB2:
        return Database.DB2;
    case DB2_AS400:
        return Database.DB2;
    case DERBY:
        return Database.DERBY;
    case H2:
        return Database.H2;
    case HSQL:
        return Database.HSQL;
    case INFORMIX:
        return Database.INFORMIX;
    case MARIADB:
        return Database.MYSQL;
    case MYSQL:
        return Database.MYSQL;
    case ORACLE:
        return Database.ORACLE;
    case POSTGRESQL:
        return Database.POSTGRESQL;
    case SQL_SERVER:
        return Database.SQL_SERVER;
    case HANA:
    case SQLITE:
    case NONE:
    default:
        break;
    }
    return null;
}
项目:holon-datastore-jpa    文件:TestMultiTenancy.java   
@Bean
public FactoryBean<EntityManagerFactory> entityManagerFactory() {
    LocalContainerEntityManagerFactoryBean emf = new LocalContainerEntityManagerFactoryBean();
    emf.setDataSource(dataSource());

    HibernateJpaVendorAdapter va = new HibernateJpaVendorAdapter();
    va.setDatabase(Database.H2);
    emf.setJpaVendorAdapter(va);

    emf.setPackagesToScan(TestJpaDomain.class.getPackage().getName());
    emf.setPersistenceUnitName("test");
    return emf;
}
项目:wormboard-backend    文件:DatabaseConfig.java   
@Bean
public JpaVendorAdapter jpaVendorAdapter()
{
  HibernateJpaVendorAdapter hibernateJpaVendorAdapter = new HibernateJpaVendorAdapter();
  hibernateJpaVendorAdapter.setShowSql(false);
  hibernateJpaVendorAdapter.setGenerateDdl(false);
  hibernateJpaVendorAdapter.setDatabase(Database.POSTGRESQL);
  return hibernateJpaVendorAdapter;
}
项目:interview-preparation    文件:DBConfig.java   
@Bean
public JpaVendorAdapter jpaVendorAdapter() {
    final HibernateJpaVendorAdapter adapter = new HibernateJpaVendorAdapter();
    adapter.setDatabase(Database.MYSQL);
    adapter.setShowSql(true);
    adapter.setGenerateDdl(true);
    adapter.setDatabasePlatform("org.hibernate.dialect.MySQL5InnoDBDialect");
    return adapter;
}
项目:interview-preparation    文件:DatabaseConfig.java   
@Bean
public JpaVendorAdapter jpaVendorAdapter() {
    final HibernateJpaVendorAdapter adapter = new HibernateJpaVendorAdapter();
    adapter.setDatabase(Database.MYSQL);
    adapter.setShowSql(true);
    adapter.setGenerateDdl(true);
    adapter.setDatabasePlatform("org.hibernate.dialect.MySQL5InnoDBDialect");
    return adapter;
}
项目:enterprise    文件:InfrastructureConfig.java   
@Bean
public JpaVendorAdapter jpaVendorAdapter() {

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

    return adapter;
}
项目:enterprise    文件:InfrastructurConfig.java   
@Bean
public JpaVendorAdapter jpaVendorAdapter() {

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

    return adapter;
}
项目:imageboard    文件:Config.java   
@Bean
public EntityManagerFactory entityManagerFactory() {
    HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
    vendorAdapter.setDatabase(Database.MYSQL);
    vendorAdapter.setGenerateDdl(true);
    vendorAdapter.setShowSql(true);

    LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean();
    factory.setJpaVendorAdapter(vendorAdapter);
    factory.setPackagesToScan(PACKAGES_TO_SCAN);
    factory.setDataSource(dataSource);
    factory.afterPropertiesSet();

    return factory.getObject();
}
项目:example-ddd-with-spring-data-jpa    文件:JpaConfiguration.java   
@Bean
protected EclipseLinkJpaVendorAdapter jpaVendorAdapter() {
    EclipseLinkJpaVendorAdapter adapter = new EclipseLinkJpaVendorAdapter();
    adapter.setDatabase(Database.MYSQL);
    adapter.setShowSql(true);
    adapter.setGenerateDdl(false);
    return adapter;
}
项目:spring-content    文件:EnableJpaStoresTest.java   
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {

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

    LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean();
    factory.setJpaVendorAdapter(vendorAdapter);
    factory.setPackagesToScan(getClass().getPackage().getName());
    factory.setDataSource(dataSource());

    return factory;
}
项目:Spring-Framework-Essentials    文件:AppConfig.java   
@Bean
public JpaVendorAdapter jpaVendorAdapter() {
    HibernateJpaVendorAdapter adapter = new HibernateJpaVendorAdapter();
    adapter.setShowSql(true);
    adapter.setGenerateDdl(true);
    adapter.setDatabase(Database.H2);
    adapter.setDatabasePlatform("org.hibernate.dialect.H2Dialect");
    return adapter;
}
项目:Spring-Framework-Essentials    文件:AppConfig.java   
@Bean
public JpaVendorAdapter jpaVendorAdapter() {
    HibernateJpaVendorAdapter adapter = new HibernateJpaVendorAdapter();
    adapter.setShowSql(true);
    adapter.setGenerateDdl(true);
    adapter.setDatabase(Database.MYSQL);
    return adapter;
}
项目:wonderjameeee    文件:DatabaseConfiguration.java   
@Bean
    public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
        HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
        vendorAdapter.setDatabase(Database.POSTGRESQL);
        vendorAdapter.setGenerateDdl(true);

        LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean();
        factory.setJpaVendorAdapter(vendorAdapter);
        factory.setPackagesToScan("hu.cherubits.wonderjam.entities");
        factory.setDataSource(dataSource());
        factory.getJpaPropertyMap().put("hibernate.dialect", PostgreSQL9Dialect.class.getCanonicalName());
//        factory.getJpaPropertyMap().put("spring.jpa.hibernate.ddl-auto", "create");

        return factory;
    }
项目:sakila-spring    文件:PersistenceConfig.java   
@Bean
public JpaVendorAdapter jpaVendorAdapter(){
    HibernateJpaVendorAdapter hibernateJpaVendorAdapter = new HibernateJpaVendorAdapter();
    hibernateJpaVendorAdapter.setShowSql(false);
    hibernateJpaVendorAdapter.setGenerateDdl(false);
    hibernateJpaVendorAdapter.setDatabase(Database.MYSQL);

    return hibernateJpaVendorAdapter;
}
项目:flowable-engine    文件:DatabaseConfiguration.java   
@Bean(name = "entityManagerFactory")
public EntityManagerFactory entityManagerFactory() {
    LocalContainerEntityManagerFactoryBean entityManagerFactoryBean = new LocalContainerEntityManagerFactoryBean();
    entityManagerFactoryBean.setDataSource(dataSource());
    entityManagerFactoryBean.setPackagesToScan("org.flowable.rest.api.jpa.model");
    entityManagerFactoryBean.setPersistenceUnitName("test");
    HibernateJpaVendorAdapter hibernateJpaVendorAdapter = new HibernateJpaVendorAdapter();
    hibernateJpaVendorAdapter.setShowSql(false);
    hibernateJpaVendorAdapter.setGenerateDdl(true);
    hibernateJpaVendorAdapter.setDatabase(Database.H2);
    entityManagerFactoryBean.setJpaVendorAdapter(hibernateJpaVendorAdapter);
    entityManagerFactoryBean.afterPropertiesSet();
    return entityManagerFactoryBean.getObject();
}
项目:spring-data-jpa-entity-graph    文件:DataRepositoryConfiguration.java   
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {

  LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean();
  factory.setDataSource(dataSource());
  factory.setMappingResources("META-INF/orm.xml");
  factory.setPackagesToScan("com.cosium.spring.data.jpa.entity.graph");

  HibernateJpaVendorAdapter jpaVendorAdapter = new HibernateJpaVendorAdapter();
  jpaVendorAdapter.setDatabase(Database.H2);
  jpaVendorAdapter.setGenerateDdl(true);
  factory.setJpaVendorAdapter(jpaVendorAdapter);

  return factory;
}
项目:spring-boot-jta-atomikos-sample    文件:MainConfig.java   
@Bean
public JpaVendorAdapter jpaVendorAdapter() {
    HibernateJpaVendorAdapter hibernateJpaVendorAdapter = new HibernateJpaVendorAdapter();
    hibernateJpaVendorAdapter.setShowSql(true);
    hibernateJpaVendorAdapter.setGenerateDdl(true);
    hibernateJpaVendorAdapter.setDatabase(Database.MYSQL);
    return hibernateJpaVendorAdapter;
}
项目:spring-data-repositories    文件:PersistenceConfiguration.java   
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
    final LocalContainerEntityManagerFactoryBean entityManagerFactoryBean = new LocalContainerEntityManagerFactoryBean();
    entityManagerFactoryBean.setDataSource(dataSource());
    entityManagerFactoryBean.setPackagesToScan("org.tuxdevelop.spring_data_repositories.domain");
    final HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
    vendorAdapter.setGenerateDdl(Boolean.TRUE);
    vendorAdapter.setDatabase(Database.H2);
    entityManagerFactoryBean.setJpaVendorAdapter(vendorAdapter);
    entityManagerFactoryBean.setPersistenceUnitName("demoPU");
    return entityManagerFactoryBean;
}
项目:Hammerhead-StatsCollector    文件:DataSourceConfiguration.java   
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
    HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
    vendorAdapter.setDatabase(Database.POSTGRESQL);
    vendorAdapter.setGenerateDdl(true);

    LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean();
    factory.setJpaVendorAdapter(vendorAdapter);
    factory.setPackagesToScan(getClass().getPackage().getName());
    factory.setDataSource(dataSource());

    return factory;
}
项目:DependencyInjectionAgent    文件:SharedJpaConfig.java   
@Bean
public JpaVendorAdapter jpaVendorAdaper() {
    HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
    // the 'database' parameter refers to the database dialect being used.
    // By default, Hibernate will use a 'HSQL' dialect because 'jpa.database' has been set to 'HSQL'
    // inside file spring/data-access.properties
    vendorAdapter.setDatabase(env.getProperty("jpa.database", Database.class));
    vendorAdapter.setShowSql(env.getProperty("jpa.showSql", Boolean.class));
    return vendorAdapter;
}
项目:demo-spring-data-jpa-hibernate-h2    文件:ApplicationConfiguration.java   
@Bean
public JpaVendorAdapter jpaVendorAdapter() {
    HibernateJpaVendorAdapter bean = new HibernateJpaVendorAdapter();
    bean.setDatabase(Database.H2);
    bean.setGenerateDdl(true);
    return bean;
}