当前位置: 首页>>代码示例>>Java>>正文


Java LocalContainerEntityManagerFactoryBean.setJpaVendorAdapter方法代码示例

本文整理汇总了Java中org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.setJpaVendorAdapter方法的典型用法代码示例。如果您正苦于以下问题:Java LocalContainerEntityManagerFactoryBean.setJpaVendorAdapter方法的具体用法?Java LocalContainerEntityManagerFactoryBean.setJpaVendorAdapter怎么用?Java LocalContainerEntityManagerFactoryBean.setJpaVendorAdapter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean的用法示例。


在下文中一共展示了LocalContainerEntityManagerFactoryBean.setJpaVendorAdapter方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: entityManagerFactory

import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; //导入方法依赖的package包/类
@Bean
public EntityManagerFactory entityManagerFactory() {
	LocalContainerEntityManagerFactoryBean emf = new LocalContainerEntityManagerFactoryBean();
	emf.setDataSource(dataSource());
	emf.setPackagesToScan("io.github.azanx.shopping_list.domain");
	emf.setPersistenceUnitName("spring-jpa-unit");
	emf.setJpaVendorAdapter(getHibernateAdapter());
	Properties jpaProperties = new Properties();
	jpaProperties.put("hibernate.dialect", env.getProperty("hibernate.dialect"));
	jpaProperties.put("hibernate.hbm2ddl.auto", env.getProperty("hibernate.hbm2ddl.auto"));
	jpaProperties.put("hibernate.show_sql", env.getProperty("hibernate.show_sql"));
	jpaProperties.put("hibernate.format_sql", env.getProperty("hibernate.format_sql"));
	emf.setJpaProperties(jpaProperties);
	emf.afterPropertiesSet();
	return emf.getObject();
}
 
开发者ID:Azanx,项目名称:Smart-Shopping,代码行数:17,代码来源:JPAConfig.java

示例2: 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;
}
 
开发者ID:omacarena,项目名称:only-short-poc,代码行数:17,代码来源:MySqlSource1Config.java

示例3: 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;
    }
 
开发者ID:JonkiPro,项目名称:REST-Web-Services,代码行数:22,代码来源:WebDatasourceConfig.java

示例4: entityManagerFactory

import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; //导入方法依赖的package包/类
@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;
}
 
开发者ID:amvnetworks,项目名称:amv-access-api-poc,代码行数:17,代码来源:JpaConfig.java

示例5: entityManagerFactory1

import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; //导入方法依赖的package包/类
@Bean
@Qualifier("one")
public FactoryBean<EntityManagerFactory> entityManagerFactory1(DataSource dataSource) {
	LocalContainerEntityManagerFactoryBean emf = new LocalContainerEntityManagerFactoryBean();
	emf.setDataSource(dataSource);
	HibernateJpaVendorAdapter va = new HibernateJpaVendorAdapter();
	va.setShowSql(true);
	emf.setJpaVendorAdapter(va);
	emf.setPackagesToScan(TestJpaDomain1.class.getPackage().getName());
	return emf;
}
 
开发者ID:holon-platform,项目名称:holon-datastore-jpa,代码行数:12,代码来源:TestDatastoreMultiConditional.java

示例6: getEntityManager

import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; //导入方法依赖的package包/类
@Bean(name="entityManagerFactory")
public LocalContainerEntityManagerFactoryBean getEntityManager(){
    // класса фабрики реализующей интерфейс FactoryBean<EntityManagerFactory>
    LocalContainerEntityManagerFactoryBean factory =
        new LocalContainerEntityManagerFactoryBean();

    // источник подключения
    factory.setDataSource(getDataSource());

    // адаптера для конкретной реализации JPA, 
    // указывает, какая библиотека будет использоваться в качестве постовщика
    factory.setJpaVendorAdapter(new HibernateJpaVendorAdapter());

    // указание пакета в котором находятся классы-сущности
    factory.setPackagesToScan("spring.domain");

    //создание свойств для настройки Hibernate
    Properties jpaProperties = new Properties();

    // диалект базы данных,необходимо для генерации запросов Hibernate к БД
    jpaProperties.put("hibernate.dialect", "org.hibernate.dialect.SQLiteDialect");

    // максимальная глубины связи(будет рассмотрено в след. уроке)
    jpaProperties.put("hibernate.max_fetch_depth", 3);

    // максимальное число строк, возвращаемых за один запрос из БД
    jpaProperties.put("hibernate.jdbc.fetch_size", 50);

    // максимальное число запросов при использовании пакетных операций
    jpaProperties.put("hibernate.jdbc.batch_size", 10);

    // включает логгирование
    jpaProperties.put("hibernate.show_sql", true);

    factory.setJpaProperties(jpaProperties);
    return factory;
}
 
开发者ID:biblelamp,项目名称:JavaEE,代码行数:38,代码来源:AppConfig.java

示例7: entityManagerFactory

import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; //导入方法依赖的package包/类
/**
 * Creates the entity manager factory.
 *
 * @param dataSource the data source to use
 * @return entity manager factory
 */
@Bean
@Primary
public LocalContainerEntityManagerFactoryBean entityManagerFactory(DataSource dataSource) {
  LocalContainerEntityManagerFactoryBean entityManagerFactoryBean =
      new LocalContainerEntityManagerFactoryBean();

  entityManagerFactoryBean.setDataSource(dataSource);

  JpaVendorAdapter jpaVendorAdapter = createJpaVendorAdapter();
  entityManagerFactoryBean.setJpaVendorAdapter(jpaVendorAdapter);

  Map<String, String> jpaPropertyMap = getJpaPropertyMap();
  entityManagerFactoryBean.setJpaPropertyMap(jpaPropertyMap);

  getMappingResources().ifPresent(entityManagerFactoryBean::setMappingResources);
  getPackagesToScan().ifPresent(entityManagerFactoryBean::setPackagesToScan);

  // https://hibernate.atlassian.net/browse/HHH-5303#comment-44439
  entityManagerFactoryBean.setSharedCacheMode(ENABLE_SELECTIVE);

  customizeEntityManagerFactoryBean(entityManagerFactoryBean);

  return entityManagerFactoryBean;
}
 
开发者ID:springuni,项目名称:springuni-particles,代码行数:31,代码来源:AbstractJpaRepositoryConfiguration.java

示例8: entityManagerFactory

import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; //导入方法依赖的package包/类
/**
 * Container managed JPA
 * This bean replaces <code>persistence.xml</code>
 * Defines packages to scan with {@link javax.persistence.Entity} annotation
 * @return Entity manager factory
 */
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory(DataSource dataSource,
                                                                   JpaVendorAdapter jpaVendorAdapter){
    LocalContainerEntityManagerFactoryBean emfb = new LocalContainerEntityManagerFactoryBean();
    emfb.setDataSource(dataSource);
    emfb.setJpaVendorAdapter(jpaVendorAdapter);
    emfb.setPackagesToScan(PACKAGE_TO_SCAN_ENTITIES);
    return emfb;
}
 
开发者ID:Vapsel,项目名称:social-media-analytic-system,代码行数:16,代码来源:DataSourceConfig.java

示例9: entityManagerFactory

import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; //导入方法依赖的package包/类
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory(DataSource dataSource, JpaVendorAdapter jpaVendorAdapter)
{
  LocalContainerEntityManagerFactoryBean lef = new LocalContainerEntityManagerFactoryBean();
  lef.setDataSource(dataSource);
  lef.setJpaVendorAdapter(jpaVendorAdapter);
  lef.setPackagesToScan("com.fetoxdevelopments.wormboard.domain");
  return lef;
}
 
开发者ID:fetox74,项目名称:wormboard-backend,代码行数:10,代码来源:DatabaseConfig.java

示例10: 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;
}
 
开发者ID:namics,项目名称:spring-i18n-support,代码行数:13,代码来源:JpaMessageSourceDaoTest.java

示例11: entityManagerFactory

import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; //导入方法依赖的package包/类
@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();
}
 
开发者ID:rusucosmin,项目名称:exampp,代码行数:15,代码来源:JPAConfig.java

示例12: entityManagerFactory

import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; //导入方法依赖的package包/类
@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;
}
 
开发者ID:holon-platform,项目名称:holon-datastore-jpa,代码行数:14,代码来源:TestMultiTenancy.java

示例13: entityManagerFactory

import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; //导入方法依赖的package包/类
@Bean
public EntityManagerFactory entityManagerFactory(JpaVendorAdapter jpaVendorAdapter, DataSource dataSource) {
	LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean();
	factory.setJpaVendorAdapter(jpaVendorAdapter);
	factory.setPackagesToScan("hello.entities");
	factory.setDataSource(dataSource);
	factory.afterPropertiesSet();
	return factory.getObject();
}
 
开发者ID:Julien35,项目名称:dev-courses,代码行数:10,代码来源:Config.java

示例14: entityManagerFactory

import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; //导入方法依赖的package包/类
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() throws NamingException {
	LocalContainerEntityManagerFactoryBean factoryBean = new LocalContainerEntityManagerFactoryBean();
	factoryBean.setDataSource(dataSource());
	factoryBean.setPackagesToScan(new String[] { "com.docker.atsea.model" });
	factoryBean.setJpaVendorAdapter(jpaVendorAdapter());
	factoryBean.setJpaProperties(jpaProperties());
	return factoryBean;
}
 
开发者ID:dockersamples,项目名称:atsea-sample-shop-app,代码行数:10,代码来源:JpaConfiguration.java

示例15: entityManagerFactory

import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean; //导入方法依赖的package包/类
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory(DataSource dataSource,
		JpaVendorAdapter jpaVendorAdapter) {
	LocalContainerEntityManagerFactoryBean lef = new LocalContainerEntityManagerFactoryBean();
	lef.setDataSource(dataSource);
	lef.setJpaVendorAdapter(jpaVendorAdapter);
	lef.setPackagesToScan("de.adesso.jenkinshue.entity");
	lef.setJpaProperties(dataSourceConfig.getJpaProperties());
	lef.afterPropertiesSet();
	return lef;
}
 
开发者ID:adessoAG,项目名称:JenkinsHue,代码行数:12,代码来源:CommonDBConfig.java


注:本文中的org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.setJpaVendorAdapter方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。