本文整理匯總了Java中org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.setJpaDialect方法的典型用法代碼示例。如果您正苦於以下問題:Java LocalContainerEntityManagerFactoryBean.setJpaDialect方法的具體用法?Java LocalContainerEntityManagerFactoryBean.setJpaDialect怎麽用?Java LocalContainerEntityManagerFactoryBean.setJpaDialect使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean
的用法示例。
在下文中一共展示了LocalContainerEntityManagerFactoryBean.setJpaDialect方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: entityManagerFactory
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; //導入方法依賴的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: entityManagerFactoryBean
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; //導入方法依賴的package包/類
/**
* EntityManager configuration.
*/
@Bean(name = "entityManagerFactory")
public LocalContainerEntityManagerFactoryBean entityManagerFactoryBean() {
final LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean();
em.setDataSource(getDatasource());
em.setJpaDialect(jpaDialect());
em.setPackagesToScan(entityManagerProperties.getPackagesToScan());
em.setPersistenceUnitName(eclipseLinkProperties.getPersistenceUnitName());
final DatabasePlatform dp = new MySQLPlatform();
em.setJpaVendorAdapter(getEclipseLinkJpaVendorAdapter());
//following code will be used for static weaving. Uncomment when creating war.
final Map<String, String> propMap = new HashMap<String, String>();
propMap.put("eclipselink.weaving", eclipseLinkProperties.getWeaving());
em.setJpaPropertyMap(propMap);
// em.setLoadTimeWeaver(loadTimeWeaver()); //comment this when using static weaving. Mostly in development environment inside eclipse
return em;
}
示例3: entityManagerFactory
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; //導入方法依賴的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();
}
示例4: entityManagerFactory
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; //導入方法依賴的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();
}
示例5: entityManagerFactory
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; //導入方法依賴的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;
}
示例6: entityManagerFactoryEcandidat
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; //導入方法依賴的package包/類
/**
* @return EntityManager Factory
*/
@Bean(name = "entityManagerFactoryEcandidat")
public LocalContainerEntityManagerFactoryBean entityManagerFactoryEcandidat() {
DataSource ds = dataSourceEcandidat();
/* Si l'appli s'initialise, il faut lancer Flyway */
/**
* TODO:problème avec tomcat8 qui reinitialise les beans au shutdown et met
* flyway en erreur
*/
String init = System.getProperty(ConstanteUtils.STARTUP_INIT_FLYWAY);
if (init == null || !init.equals(ConstanteUtils.STARTUP_INIT_FLYWAY_OK)) {
initFlyway(ds);
System.setProperty(ConstanteUtils.STARTUP_INIT_FLYWAY, ConstanteUtils.STARTUP_INIT_FLYWAY_OK);
}
LocalContainerEntityManagerFactoryBean localContainerEntityManagerFactoryBean = new LocalContainerEntityManagerFactoryBean();
localContainerEntityManagerFactoryBean.setPersistenceUnitName(PERSISTENCE_UNIT_NAME);
localContainerEntityManagerFactoryBean.setPackagesToScan(Candidat.class.getPackage().getName(),
LocalTimePersistenceConverter.class.getPackage().getName());
localContainerEntityManagerFactoryBean.setDataSource(ds);
localContainerEntityManagerFactoryBean.setJpaDialect(new EclipseLinkJpaDialect());
Properties jpaProperties = new Properties();
/* Active le static weaving d'EclipseLink */
jpaProperties.put(PersistenceUnitProperties.WEAVING, "static");
/* Désactive le cache partagé */
jpaProperties.put(PersistenceUnitProperties.CACHE_SHARED_DEFAULT, String.valueOf(false));
localContainerEntityManagerFactoryBean.setJpaProperties(jpaProperties);
EclipseLinkJpaVendorAdapter jpaVendorAdapter = new EclipseLinkJpaVendorAdapter();
jpaVendorAdapter.setGenerateDdl(false);
jpaVendorAdapter.setShowSql(false);
localContainerEntityManagerFactoryBean.setJpaVendorAdapter(jpaVendorAdapter);
return localContainerEntityManagerFactoryBean;
}
示例7: entityManagerFactory
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; //導入方法依賴的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;
}