當前位置: 首頁>>代碼示例>>Java>>正文


Java HibernateJpaVendorAdapter.setDatabasePlatform方法代碼示例

本文整理匯總了Java中org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter.setDatabasePlatform方法的典型用法代碼示例。如果您正苦於以下問題:Java HibernateJpaVendorAdapter.setDatabasePlatform方法的具體用法?Java HibernateJpaVendorAdapter.setDatabasePlatform怎麽用?Java HibernateJpaVendorAdapter.setDatabasePlatform使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter的用法示例。


在下文中一共展示了HibernateJpaVendorAdapter.setDatabasePlatform方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: entityManagerFactoryBean

import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter; //導入方法依賴的package包/類
@Bean(name = "entityManagerFactory")
public LocalContainerEntityManagerFactoryBean entityManagerFactoryBean() {
    LocalContainerEntityManagerFactoryBean factoryBean = new LocalContainerEntityManagerFactoryBean();
    factoryBean.setDataSource(dataSource());
    factoryBean.setPackagesToScan("com.chinedu.truststack.persist");

    HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
    vendorAdapter.setShowSql(true);
    vendorAdapter.setDatabasePlatform(hibernateDialect);
    factoryBean.setJpaVendorAdapter(vendorAdapter);

    Properties jpaProperties = new Properties();
    jpaProperties.put("hibernate.show_sql",hibernateShowSql);
    jpaProperties.put("hibernate.hbm2ddl.auto",hibernateUpate);
    factoryBean.setJpaProperties(jpaProperties);
    return factoryBean;
}
 
開發者ID:csokafor,項目名稱:spring-security-angularjs,代碼行數:18,代碼來源:JPAConfig.java

示例2: entityManagerFactory

import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter; //導入方法依賴的package包/類
@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();
}
 
開發者ID:xtianus,項目名稱:yadaframework,代碼行數:20,代碼來源:YadaJpaConfig.java

示例3: entityManagerFactoryBean

import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter; //導入方法依賴的package包/類
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactoryBean() {
	Map<String, Object> properties = new Hashtable<>();
	properties.put("javax.persistence.schema-generation.database.action", "none");
	properties.put("hibernate.connection.characterEncoding", "utf8");
	properties.put("hibernate.connection.useUnicode", "true");
	properties.put("hibernate.connection.charSet", "utf8");
	properties.put("hibernate.search.default.directory_provider", "filesystem");
	properties.put("hibernate.search.default.indexBase", context.getInitParameter("indexDir"));

	HibernateJpaVendorAdapter adapter = new HibernateJpaVendorAdapter();
	adapter.setDatabasePlatform("org.hibernate.dialect.MySQL5InnoDBDialect");

	LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean();
	factory.setJpaVendorAdapter(adapter);
	factory.setDataSource(this.bookManagerDataSource());
	factory.setPackagesToScan("net.viperfish.bookManager");
	factory.setSharedCacheMode(SharedCacheMode.ENABLE_SELECTIVE);
	factory.setValidationMode(ValidationMode.NONE);
	factory.setJpaPropertyMap(properties);
	return factory;
}
 
開發者ID:shilongdai,項目名稱:bookManager,代碼行數:23,代碼來源:RootApplicationContextConfig.java

示例4: entityManagerFactory

import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter; //導入方法依賴的package包/類
/**
 * Creates EntityManagerFactory.
 * @return LocalContainerEntityManagerFactoryBean
 */
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
    
    HibernateJpaVendorAdapter hibernateJpa = new HibernateJpaVendorAdapter();
    hibernateJpa.setDatabasePlatform("org.hibernate.dialect.PostgreSQLDialect");
    hibernateJpa.setShowSql(false);
    hibernateJpa.setGenerateDdl(true);
    
    LocalContainerEntityManagerFactoryBean emf = new LocalContainerEntityManagerFactoryBean();
    emf.setDataSource(dataSource);
    emf.setPackagesToScan("pl.orange.labs");
    emf.setJpaVendorAdapter(hibernateJpa);
    emf.setJpaPropertyMap(Collections.singletonMap("javax.persistence.validation.mode", "none"));
    emf.setPersistenceUnitName("Mundo");
    return emf;
}
 
開發者ID:MUNDO-platform,項目名稱:srccode,代碼行數:21,代碼來源:JpaConfig.java

示例5: entityManagerFactory

import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter; //導入方法依賴的package包/類
@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();
}
 
開發者ID:ThiagoUriel,項目名稱:spring-agora-web,代碼行數:26,代碼來源:ApplicationConfig.java

示例6: jpaVendorAdapter

import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter; //導入方法依賴的package包/類
/**
 * 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;
}
 
開發者ID:Vapsel,項目名稱:social-media-analytic-system,代碼行數:14,代碼來源:DataSourceConfig.java

示例7: jpaVendorAdapter

import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter; //導入方法依賴的package包/類
@Bean
public JpaVendorAdapter jpaVendorAdapter() {
    HibernateJpaVendorAdapter adapter = new HibernateJpaVendorAdapter();
    adapter.setDatabasePlatform("org.hibernate.dialect.MySQL5InnoDBDialect");
    adapter.setGenerateDdl(true);
    return adapter;
}
 
開發者ID:chaokunyang,項目名稱:amanda,代碼行數:8,代碼來源:RootContextConfiguration.java

示例8: jpaVendorAdapter

import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter; //導入方法依賴的package包/類
@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;
}
 
開發者ID:tvajjala,項目名稱:interview-preparation,代碼行數:10,代碼來源:DBConfig.java

示例9: jpaVendorAdapter

import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter; //導入方法依賴的package包/類
@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;
}
 
開發者ID:kousen,項目名稱:Spring-Framework-Essentials,代碼行數:10,代碼來源:AppConfig.java

示例10: devVendorAdapter

import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter; //導入方法依賴的package包/類
@Bean
@Profile("h2Db")
public JpaVendorAdapter devVendorAdapter(ConfigProperties config) {
    HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
    vendorAdapter.setDatabasePlatform(config.getJdbcDialect());
    vendorAdapter.setGenerateDdl(true);
    vendorAdapter.setShowSql(config.getJdbcShowSql());
    return vendorAdapter;
}
 
開發者ID:mattpwest,項目名稱:entelect-spring-webapp-template,代碼行數:10,代碼來源:JPAConfig.java

示例11: deployedVendorAdapter

import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter; //導入方法依賴的package包/類
@Bean
@Profile("sqlDb")
public JpaVendorAdapter deployedVendorAdapter(ConfigProperties config) {
    HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
    vendorAdapter.setDatabasePlatform(config.getJdbcDialect());
    vendorAdapter.setGenerateDdl(false);
    vendorAdapter.setShowSql(config.getJdbcShowSql());
    return vendorAdapter;
}
 
開發者ID:mattpwest,項目名稱:entelect-spring-webapp-template,代碼行數:10,代碼來源:JPAConfig.java

示例12: jpaVendorAdapter

import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter; //導入方法依賴的package包/類
@Bean
public JpaVendorAdapter jpaVendorAdapter() {
    HibernateJpaVendorAdapter hibernateJpaVendorAdapter = new HibernateJpaVendorAdapter();
    hibernateJpaVendorAdapter.setShowSql(showSql);
    hibernateJpaVendorAdapter.setGenerateDdl(hbm2ddlAuto);
    hibernateJpaVendorAdapter.setDatabase(dataBase());
    hibernateJpaVendorAdapter.setDatabasePlatform(dialect);
    return hibernateJpaVendorAdapter;
}
 
開發者ID:przodownikR1,項目名稱:springJpaKata,代碼行數:10,代碼來源:JpaConfig.java

示例13: entityManagerFactoryBean

import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter; //導入方法依賴的package包/類
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactoryBean()
		throws ConfigurationException, IOException {
	Map<String, Object> properties = new Hashtable<>();
	String indexPath = this.configuration().getString(GlobalConfig.INDEX_PATH);
	if (indexPath == null) {
		indexPath = GlobalConfig.INDEX_PATH_DEFAULT;
	}
	properties.put("javax.persistence.schema-generation.database.action", "none");
	properties.put("hibernate.connection.characterEncoding", "utf8");
	properties.put("hibernate.connection.useUnicode", "true");
	properties.put("hibernate.connection.charSet", "utf8");
	properties.put("hibernate.search.default.directory_provider", "filesystem");
	properties.put("hibernate.search.default.indexBase", indexPath);

	HibernateJpaVendorAdapter adapter = new HibernateJpaVendorAdapter();
	adapter.setDatabasePlatform("org.hibernate.dialect.MySQL5InnoDBDialect");

	LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean();
	factory.setJpaVendorAdapter(adapter);
	factory.setDataSource(this.chatDataSource());
	factory.setPackagesToScan("net.viperfish.chatapplication");
	factory.setSharedCacheMode(SharedCacheMode.ENABLE_SELECTIVE);
	factory.setValidationMode(ValidationMode.NONE);
	factory.setJpaPropertyMap(properties);
	return factory;
}
 
開發者ID:shilongdai,項目名稱:LSChatServer,代碼行數:28,代碼來源:ApplicationRootContext.java

示例14: entityManagerFactory

import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter; //導入方法依賴的package包/類
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
  HibernateJpaVendorAdapter hibernateJpaVendorAdapter = new HibernateJpaVendorAdapter();
  hibernateJpaVendorAdapter.setGenerateDdl(true);
  hibernateJpaVendorAdapter.setDatabasePlatform("org.hibernate.dialect.H2Dialect");

  LocalContainerEntityManagerFactoryBean entityManagerFactoryBean = new LocalContainerEntityManagerFactoryBean();
  entityManagerFactoryBean.setDataSource(dataSource());
  entityManagerFactoryBean.setJpaVendorAdapter(hibernateJpaVendorAdapter);
  entityManagerFactoryBean.setPackagesToScan(environment.getRequiredProperty(ENTITYMANAGER_PACKAGES_TO_SCAN));
  entityManagerFactoryBean.setJpaProperties(hibernateProperties());
  entityManagerFactoryBean.afterPropertiesSet();

  return entityManagerFactoryBean;
}
 
開發者ID:yelzhanzh,項目名稱:simplewebapp.com,代碼行數:16,代碼來源:DataBaseConfig.java

示例15: jpaVendorAdapter

import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter; //導入方法依賴的package包/類
@Bean
public JpaVendorAdapter jpaVendorAdapter() {
    HibernateJpaVendorAdapter hibernateJpaVendorAdapter = new HibernateJpaVendorAdapter();
    hibernateJpaVendorAdapter.setShowSql(false);
    hibernateJpaVendorAdapter.setGenerateDdl(true);
    hibernateJpaVendorAdapter.setDatabase(Database.MYSQL);
    hibernateJpaVendorAdapter.setDatabasePlatform("org.hibernate.dialect.MySQL5Dialect");
    return hibernateJpaVendorAdapter;
}
 
開發者ID:joemarmatulac,項目名稱:spring-boot-data-jpa-mysql,代碼行數:10,代碼來源:DatabaseConfig.java


注:本文中的org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter.setDatabasePlatform方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。