本文整理汇总了Java中org.springframework.orm.jpa.vendor.HibernateJpaDialect类的典型用法代码示例。如果您正苦于以下问题:Java HibernateJpaDialect类的具体用法?Java HibernateJpaDialect怎么用?Java HibernateJpaDialect使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
HibernateJpaDialect类属于org.springframework.orm.jpa.vendor包,在下文中一共展示了HibernateJpaDialect类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: entityManagerFactory
import org.springframework.orm.jpa.vendor.HibernateJpaDialect; //导入依赖的package包/类
@Bean(EntityManagerFactoryBeanName)
@Primary
public LocalContainerEntityManagerFactoryBean entityManagerFactory(
@Qualifier(DataSourceBeanName) DataSource dataSource,
@Qualifier(JpaVendorAdapterBeanName) JpaVendorAdapter vendorAdapter) {
LocalContainerEntityManagerFactoryBean entityManagerFactoryBean = new LocalContainerEntityManagerFactoryBean();
entityManagerFactoryBean.setDataSource(dataSource);
entityManagerFactoryBean.setJpaVendorAdapter(vendorAdapter);
entityManagerFactoryBean.setJpaDialect(new HibernateJpaDialect());
entityManagerFactoryBean.setPackagesToScan(Organization.class.getPackage().getName());
entityManagerFactoryBean.setPersistenceUnitName("mysqlsource1");
entityManagerFactoryBean.afterPropertiesSet();
return entityManagerFactoryBean;
}
示例2: entityManagerFactory
import org.springframework.orm.jpa.vendor.HibernateJpaDialect; //导入依赖的package包/类
@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();
}
示例3: entityManagerFactory
import org.springframework.orm.jpa.vendor.HibernateJpaDialect; //导入依赖的package包/类
@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();
}
示例4: entityManagerFactory
import org.springframework.orm.jpa.vendor.HibernateJpaDialect; //导入依赖的package包/类
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
final LocalContainerEntityManagerFactoryBean emf = new LocalContainerEntityManagerFactoryBean();
emf.setJpaDialect(new HibernateJpaDialect());
emf.setJpaVendorAdapter(jpaVendorAdapter());
emf.setJpaPropertyMap(jpaProperties());
emf.setPackagesToScan(Constants.APPLICATION_ROOT_PACKAGE);
emf.setDataSource(dataSource);
// Setup Papertrail before Liquibase
papertrailConfig.configureAuditLogAppender();
// Run Liquibase migrations before ORM setup
liquibaseConfig.upgradeDatabase();
return emf;
}
示例5: entityManagerFactory
import org.springframework.orm.jpa.vendor.HibernateJpaDialect; //导入依赖的package包/类
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() throws URISyntaxException {
LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean();
factory.setJpaDialect(new HibernateJpaDialect());
HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
vendorAdapter.setGenerateDdl(true);
factory.setJpaVendorAdapter(vendorAdapter);
factory.setPersistenceUnitName("production");
factory.setPackagesToScan("app.domain");
factory.setDataSource(dataSource());
factory.afterPropertiesSet();
return factory;
}
示例6: metaEntityManager
import org.springframework.orm.jpa.vendor.HibernateJpaDialect; //导入依赖的package包/类
@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;
}
示例7: entityManagerFactory
import org.springframework.orm.jpa.vendor.HibernateJpaDialect; //导入依赖的package包/类
@Bean
@Nonnull
public EntityManagerFactory entityManagerFactory() throws SQLException {
final Properties properties = new Properties();
properties.setProperty("hibernate.dialect", env.getProperty("db.hibernate.dialect"));
properties.setProperty("hibernate.hbm2ddl.auto", env.getProperty("db.hibernate.hbm2ddl.auto"));
properties.setProperty("hibernate.temp.use_jdbc_metadata_defaults", "false");
final LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean();
factory.setJpaVendorAdapter(new HibernateJpaVendorAdapter());
factory.setJpaDialect(new HibernateJpaDialect());
factory.setDataSource(pgDataSource());
factory.setPackagesToScan(this.getClass().getPackage().getName());
factory.setJpaProperties(properties);
factory.afterPropertiesSet();
return factory.getObject();
}
示例8: entityManagerFactory
import org.springframework.orm.jpa.vendor.HibernateJpaDialect; //导入依赖的package包/类
@Bean(name = "entityManagerFactory")
public EntityManagerFactory entityManagerFactory() {
LocalContainerEntityManagerFactoryBean lcemfb = new LocalContainerEntityManagerFactoryBean();
lcemfb.setDataSource(dataSource());
lcemfb.setJpaDialect(new HibernateJpaDialect());
lcemfb.setJpaVendorAdapter(jpaVendorAdapter());
lcemfb.setPackagesToScan("org.springframework.data.demo");
lcemfb.setPersistenceUnitName("persistenceUnit");
lcemfb.setPersistenceXmlLocation("classpath:META-INF/persistence.xml");
lcemfb.getJpaPropertyMap().put("hibernate.ejb.naming_strategy", org.hibernate.cfg.ImprovedNamingStrategy.class.getCanonicalName());
if ("mysql".equals(databaseType)) {
lcemfb.getJpaPropertyMap().put("hibernate.dialect", org.hibernate.dialect.MySQL5InnoDBDialect.class.getCanonicalName());
} else if ("h2".equals(databaseType)) {
lcemfb.getJpaPropertyMap().put("hibernate.dialect", org.hibernate.dialect.H2Dialect.class.getCanonicalName());
} else if ("derby".equals(databaseType)) {
lcemfb.getJpaPropertyMap().put("hibernate.dialect", org.hibernate.dialect.DerbyTenSevenDialect.class.getCanonicalName());
} else {
throw new RuntimeException("database.type must be configured");
}
lcemfb.getJpaPropertyMap().put("hibernate.hbm2ddl.auto", "update");
lcemfb.getJpaPropertyMap().put("hibernate.hbm2ddl.format", "false");
lcemfb.getJpaPropertyMap().put("hibernate.hbm2ddl.export", "true");
lcemfb.getJpaPropertyMap().put("cache.provider_class", "org.hibernate.cache.NoCacheProvider");
lcemfb.afterPropertiesSet();
return lcemfb.getObject();
}
示例9: entityManagerFactory
import org.springframework.orm.jpa.vendor.HibernateJpaDialect; //导入依赖的package包/类
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() throws PropertyVetoException, ClassNotFoundException {
LocalContainerEntityManagerFactoryBean entityManagerFactoryBean = new LocalContainerEntityManagerFactoryBean();
/**
* Renamed to jpa-persistence.xml cause Spring will manage the DataSource and not the
* container.
*/
entityManagerFactoryBean.setPersistenceXmlLocation("classpath*:META-INF/jpa-persistence.xml");
entityManagerFactoryBean.setDataSource(dataSource());
entityManagerFactoryBean.setJpaDialect(new HibernateJpaDialect());
entityManagerFactoryBean.setJpaVendorAdapter(new HibernateJpaVendorAdapter());
entityManagerFactoryBean.setJpaProperties(getJpaProperties());
return entityManagerFactoryBean;
}
示例10: jpaProperties
import org.springframework.orm.jpa.vendor.HibernateJpaDialect; //导入依赖的package包/类
public Properties jpaProperties() {
Properties props = new Properties();
props.put(Environment.HBM2DDL_AUTO, "create"); // create | spawn | spawn-drop | update | validate | none
props.put(Environment.FORMAT_SQL, "true");
props.put(Environment.SHOW_SQL, "true");
props.put(Environment.RELEASE_CONNECTIONS, ConnectionReleaseMode.ON_CLOSE);
props.put(Environment.AUTOCOMMIT, "true");
props.put(Environment.STATEMENT_BATCH_SIZE, 100);
props.put(Environment.DIALECT, getDialect());
props.put("jpaDialect", HibernateJpaDialect.class.getName());
return props;
}
示例11: entityManagerFactory
import org.springframework.orm.jpa.vendor.HibernateJpaDialect; //导入依赖的package包/类
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() throws PropertyVetoException {
LocalContainerEntityManagerFactoryBean entityManagerFactoryBean = new LocalContainerEntityManagerFactoryBean();
entityManagerFactoryBean.setDataSource(dataSource());
/**
* Renamed to jpa-persistence.xml cause Spring will manage the DataSource and not the
* container.
*/
entityManagerFactoryBean.setPersistenceXmlLocation("classpath*:META-INF/jpa-persistence.xml");
entityManagerFactoryBean.setJpaDialect(new HibernateJpaDialect());
entityManagerFactoryBean.setJpaVendorAdapter(new HibernateJpaVendorAdapter());
return entityManagerFactoryBean;
}
示例12: entityManagerFactory
import org.springframework.orm.jpa.vendor.HibernateJpaDialect; //导入依赖的package包/类
@Bean
@DependsOn({"cacheManager",
"springLiquibase"})
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
final HibernateJpaVendorAdapter jpaVendorAdapter = new HibernateJpaVendorAdapter();
jpaVendorAdapter.setDatabase(jpaVendorDatabase);
final Map<String, Object> jpaProperties = new LinkedHashMap<>();
jpaProperties.put("hibernate.cache.region.factory_class", hibernateEhcacheRegionFactoryClass);
jpaProperties.put("hibernate.cache.use_query_cache", hibernateUseQueryCache);
jpaProperties.put("hibernate.cache.use_second_level_cache", hibernateUseSecondLevelCache);
jpaProperties.put("hibernate.hbm2ddl.auto", hibernateHbm2ddl);
final LocalContainerEntityManagerFactoryBean entityManagerFactoryBean = new LocalContainerEntityManagerFactoryBean();
entityManagerFactoryBean.setDataSource(dataSource());
entityManagerFactoryBean.setJpaDialect(new HibernateJpaDialect());
entityManagerFactoryBean.setJpaVendorAdapter(jpaVendorAdapter);
entityManagerFactoryBean.setPackagesToScan("org.unidle.domain");
entityManagerFactoryBean.setJpaPropertyMap(jpaProperties);
entityManagerFactoryBean.setMappingResources("jpa/orm.xml");
return entityManagerFactoryBean;
}
示例13: entityManagerFactory
import org.springframework.orm.jpa.vendor.HibernateJpaDialect; //导入依赖的package包/类
@Bean(EntityManagerFactoryBeanName)
public LocalContainerEntityManagerFactoryBean entityManagerFactory(
@Qualifier(DataSourceBeanName) DataSource dataSource,
@Qualifier(JpaVendorAdapterBeanName) JpaVendorAdapter vendorAdapter) {
LocalContainerEntityManagerFactoryBean entityManagerFactoryBean = new LocalContainerEntityManagerFactoryBean();
entityManagerFactoryBean.setDataSource(dataSource);
entityManagerFactoryBean.setJpaVendorAdapter(vendorAdapter);
entityManagerFactoryBean.setJpaDialect(new HibernateJpaDialect());
entityManagerFactoryBean.setPackagesToScan(Organization.class.getPackage().getName());
entityManagerFactoryBean.setPersistenceUnitName("mysqlsource2");
entityManagerFactoryBean.afterPropertiesSet();
return entityManagerFactoryBean;
}
示例14: entityManagerFactory
import org.springframework.orm.jpa.vendor.HibernateJpaDialect; //导入依赖的package包/类
@Bean
public FactoryBean<EntityManagerFactory> entityManagerFactory() {
LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean();
factory.setDataSource(dataSource());
factory.setJpaVendorAdapter(jpaVendorAdapter());
factory.setPackagesToScan("com.namics.oss.spring.support.i18n.dao.jpa");
factory.setPersistenceUnitName("jpaPersistenceUnit");
factory.setJpaProperties(jpaProperties());
factory.setJpaDialect(new HibernateJpaDialect());
return factory;
}
示例15: transactionManager
import org.springframework.orm.jpa.vendor.HibernateJpaDialect; //导入依赖的package包/类
@Bean
@Autowired
public JpaTransactionManager transactionManager(EntityManagerFactory entityManagerFactory) {
JpaTransactionManager txManager = new JpaTransactionManager();
JpaDialect jpaDialect = new HibernateJpaDialect();
txManager.setEntityManagerFactory(entityManagerFactory);
txManager.setJpaDialect(jpaDialect);
return txManager;
}