本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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();
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}