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


Java JpaVendorAdapter类代码示例

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


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

示例1: entityManagerFactory

import org.springframework.orm.jpa.JpaVendorAdapter; //导入依赖的package包/类
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
	LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean();

	JpaVendorAdapter jpaVendorAdapter = new HibernateJpaVendorAdapter();

	DriverManagerDataSource dataSource = new DriverManagerDataSource();
	dataSource.setUsername("root");
	dataSource.setPassword("");
	dataSource.setUrl("jdbc:mysql://localhost:3306/ensaiospring");
	dataSource.setDriverClassName("com.mysql.jdbc.Driver");

	Properties props = new Properties();
	props.setProperty("hibernate.dialect",
			"org.hibernate.dialect.MySQL5Dialect");
	props.setProperty("hibernate.show_sql", "true");
	props.setProperty("hibernate.hbm2ddl.auto", "update");

	factory.setJpaVendorAdapter(jpaVendorAdapter);
	factory.setDataSource(dataSource);
	factory.setJpaProperties(props);
	factory.setPackagesToScan("br.com.ciaware.springmvc.ensaio.models");

	return factory;
}
 
开发者ID:flaviociaware,项目名称:cwEnsaiosWeb,代码行数:26,代码来源:JPAConfiguration.java

示例2: entityManagerFactory

import org.springframework.orm.jpa.JpaVendorAdapter; //导入依赖的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: entityManagerFactory

import org.springframework.orm.jpa.JpaVendorAdapter; //导入依赖的package包/类
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory(
        DataSource dataSource, JpaVendorAdapter jpaVendorAdapter) {

    Properties props = new Properties();
    props.setProperty("hibernate.format_sql", String.valueOf(true));
    
    LocalContainerEntityManagerFactoryBean emf =
            new LocalContainerEntityManagerFactoryBean();
    emf.setDataSource(dataSource);
    emf.setPackagesToScan("com.oreilly.entities");
    emf.setJpaVendorAdapter(jpaVendorAdapter);
    emf.setJpaProperties(props);

    return emf;
}
 
开发者ID:kousen,项目名称:Spring-Framework-Essentials,代码行数:17,代码来源:AppConfig.java

示例4: entityManagerFactory

import org.springframework.orm.jpa.JpaVendorAdapter; //导入依赖的package包/类
@Bean(name = "coreEntityManager")
public LocalContainerEntityManagerFactoryBean entityManagerFactory()
{
    if (driver == null){
        throw new IllegalStateException("cannot find db.type property with valid value ( mysql,ms-sql)");
    }
    driver.create();
    LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean();
    em.setDataSource(driver.create());
    em.setPackagesToScan(new String[]{"com"});
    JpaVendorAdapter adapter = new HibernateJpaVendorAdapter();
    HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
    vendorAdapter.setShowSql(false);
    vendorAdapter.setGenerateDdl(false);

    em.setJpaVendorAdapter(vendorAdapter);
    em.setJpaProperties(additionalProperties());
    return em;
}
 
开发者ID:aranga-nana,项目名称:angular-spring-boot-micro-services-docker,代码行数:20,代码来源:JPAConfig.java

示例5: entityManagerFactoryBuilder

import org.springframework.orm.jpa.JpaVendorAdapter; //导入依赖的package包/类
@Bean
@ConditionalOnMissingBean
public EntityManagerFactoryBuilder entityManagerFactoryBuilder(
		JpaVendorAdapter jpaVendorAdapter,
		ObjectProvider<PersistenceUnitManager> persistenceUnitManagerProvider) {
	EntityManagerFactoryBuilder builder = new EntityManagerFactoryBuilder(
			jpaVendorAdapter, this.properties.getProperties(),
			persistenceUnitManagerProvider.getIfAvailable());
	builder.setCallback(getVendorCallback());
	return builder;
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:12,代码来源:JpaBaseConfiguration.java

示例6: entityManagerFactory

import org.springframework.orm.jpa.JpaVendorAdapter; //导入依赖的package包/类
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory(
        DataSource dataSource, JpaVendorAdapter jpaVendorAdapter) {

    Properties props = new Properties();
    props.setProperty("hibernate.format_sql", String.valueOf(true));

    LocalContainerEntityManagerFactoryBean emf =
            new LocalContainerEntityManagerFactoryBean();
    emf.setDataSource(dataSource);
    emf.setPackagesToScan("com.oreilly.entities");
    emf.setJpaVendorAdapter(jpaVendorAdapter);
    emf.setJpaProperties(props);

    return emf;
}
 
开发者ID:kousen,项目名称:Spring-Framework-Essentials,代码行数:17,代码来源:AppConfig.java

示例7: serverEntityManagerFactory

import org.springframework.orm.jpa.JpaVendorAdapter; //导入依赖的package包/类
@Bean(name = "entityManagerFactory")
@DependsOn("flyway")
@Profile("sqlDb")
public LocalContainerEntityManagerFactoryBean serverEntityManagerFactory(DataSource dataSource,
                                                                         JpaVendorAdapter vendorAdapter,
                                                                         LoadTimeWeaver loadTimeWeaver,
                                                                         Properties hibernateProperties) {

    LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean();
    em.setDataSource(dataSource);
    em.setJpaVendorAdapter(vendorAdapter);
    em.setLoadTimeWeaver(loadTimeWeaver);
    em.setJpaProperties(hibernateProperties);
    em.setPackagesToScan(ENTITIES_PACKAGE);
    return em;
}
 
开发者ID:mattpwest,项目名称:entelect-spring-webapp-template,代码行数:17,代码来源:JPAConfig.java

示例8: createEntityManagerFactory

import org.springframework.orm.jpa.JpaVendorAdapter; //导入依赖的package包/类
private EntityManagerFactory createEntityManagerFactory() {
    Assertions.assertThat(persistenceUnitContextManager.isValidPersistenceUnit(persistenceUnitName))
            .as("Not a valid persistence unit: %s", persistenceUnitName)
            .isTrue();
    final LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean();
    factory.setPersistenceUnitManager(persistenceUnitManager);
    factory.setPersistenceUnitName(persistenceUnitName);
    final JpaVendorAdapter jpaVendorAdapter = getJpaVendorAdapter();
    if (jpaVendorAdapter != null) {
        factory.setJpaVendorAdapter(jpaVendorAdapter);
    } else {
        factory.setPersistenceProvider(getPersistenceProvider());
    }
    final JpaDialect jpaDialect = getJpaDialect();
    if (jpaDialect != null) {
        factory.setJpaDialect(jpaDialect);
    }
    factory.afterPropertiesSet();
    final String entityManagerFactoryBeanName = getPersistenceUnitName()
            + PersistenceProperties.ENTITY_MANAGER_FACTORY_NAME_SUFFIX;
    MergedContext.getInstance().registerBean(entityManagerFactoryBeanName, factory);
    Assertions.assertThat(MergedContext.getInstance().getBean(entityManagerFactoryBeanName)).isNotNull();
    return factory.getObject();
}
 
开发者ID:subes,项目名称:invesdwin-context-persistence,代码行数:25,代码来源:PersistenceUnitContext.java

示例9: getHibernateJpaVendorAdapter

import org.springframework.orm.jpa.JpaVendorAdapter; //导入依赖的package包/类
/**
 * Gets the Hibernate JPA vendor adapter needed by the entity manager.
 *
 * @return the Hibernate JPA vendor adapter.
 */
private JpaVendorAdapter getHibernateJpaVendorAdapter()
{
    HibernateJpaVendorAdapter hibernateJpaVendorAdapter = new HibernateJpaVendorAdapter();
    // Set the database type.
    String databaseType = configurationHelper.getProperty(ConfigurationValue.DATABASE_TYPE);
    if (StringUtils.isBlank(databaseType))
    {
        throw new IllegalStateException(
            String.format("No database type found. Ensure the \"%s\" configuration entry is configured.", ConfigurationValue.DATABASE_TYPE.getKey()));
    }
    Database database = Database.valueOf(databaseType);
    LOGGER.info("jpaTargetDatabase={}", database);
    hibernateJpaVendorAdapter.setDatabase(database);
    hibernateJpaVendorAdapter.setGenerateDdl(false);
    return hibernateJpaVendorAdapter;
}
 
开发者ID:FINRAOS,项目名称:herd,代码行数:22,代码来源:DaoSpringModuleConfig.java

示例10: JpaConfigDataHolder

import org.springframework.orm.jpa.JpaVendorAdapter; //导入依赖的package包/类
public JpaConfigDataHolder(final JpaVendorAdapter jpaVendorAdapter,
                           final String persistenceUnitName,
                           final String[] packagesToScan,
                           final DataSource dataSource) {
    this.jpaVendorAdapter = jpaVendorAdapter;
    this.persistenceUnitName = persistenceUnitName;
    this.packagesToScan = packagesToScan;
    this.dataSource = dataSource;
}
 
开发者ID:mrluo735,项目名称:cas-5.1.0,代码行数:10,代码来源:JpaConfigDataHolder.java

示例11: jpaVendorAdapter

import org.springframework.orm.jpa.JpaVendorAdapter; //导入依赖的package包/类
@Bean
public JpaVendorAdapter jpaVendorAdapter() {
	HibernateJpaVendorAdapter hibernateJpaVendorAdapter = new HibernateJpaVendorAdapter();
	hibernateJpaVendorAdapter.setShowSql(true);
	hibernateJpaVendorAdapter.setGenerateDdl(true);
	hibernateJpaVendorAdapter.setDatabase(Database.H2);
	return hibernateJpaVendorAdapter;
}
 
开发者ID:adessoAG,项目名称:JenkinsHue,代码行数:9,代码来源:H2DBConfig.java

示例12: entityManagerFactory

import org.springframework.orm.jpa.JpaVendorAdapter; //导入依赖的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

示例13: jpaVendorAdapter

import org.springframework.orm.jpa.JpaVendorAdapter; //导入依赖的package包/类
@Bean
public JpaVendorAdapter jpaVendorAdapter() {
	HibernateJpaVendorAdapter hibernateJpaVendorAdapter = new HibernateJpaVendorAdapter();
	hibernateJpaVendorAdapter.setShowSql(sql);
	hibernateJpaVendorAdapter.setGenerateDdl(sql);
	hibernateJpaVendorAdapter.setDatabase(Database.POSTGRESQL);
	return hibernateJpaVendorAdapter;
}
 
开发者ID:adessoAG,项目名称:JenkinsHue,代码行数:9,代码来源:PostgreSQLDBConfig.java

示例14: entityManagerFactory

import org.springframework.orm.jpa.JpaVendorAdapter; //导入依赖的package包/类
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean();
em.setDataSource(dataSource());
em.setPackagesToScan("org.restaurant.repository.model");

JpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
em.setJpaVendorAdapter(vendorAdapter);
em.setJpaProperties(additionalProperties());

return em;
}
 
开发者ID:juanjo8600,项目名称:restaurant,代码行数:13,代码来源:RepositoryConfiguration.java

示例15: entityManagerFactory

import org.springframework.orm.jpa.JpaVendorAdapter; //导入依赖的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;
}
 
开发者ID:omacarena,项目名称:only-short-poc,代码行数:16,代码来源:MySqlSource2Config.java


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