當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。