本文整理汇总了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;
}
示例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();
}
示例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;
}
示例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;
}
示例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();
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}