本文整理汇总了Java中org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter.setShowSql方法的典型用法代码示例。如果您正苦于以下问题:Java HibernateJpaVendorAdapter.setShowSql方法的具体用法?Java HibernateJpaVendorAdapter.setShowSql怎么用?Java HibernateJpaVendorAdapter.setShowSql使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter
的用法示例。
在下文中一共展示了HibernateJpaVendorAdapter.setShowSql方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: entityManagerFactoryBean
import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter; //导入方法依赖的package包/类
@Bean(name = "entityManagerFactory")
public LocalContainerEntityManagerFactoryBean entityManagerFactoryBean() {
LocalContainerEntityManagerFactoryBean factoryBean = new LocalContainerEntityManagerFactoryBean();
factoryBean.setDataSource(dataSource());
factoryBean.setPackagesToScan("com.chinedu.truststack.persist");
HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
vendorAdapter.setShowSql(true);
vendorAdapter.setDatabasePlatform(hibernateDialect);
factoryBean.setJpaVendorAdapter(vendorAdapter);
Properties jpaProperties = new Properties();
jpaProperties.put("hibernate.show_sql",hibernateShowSql);
jpaProperties.put("hibernate.hbm2ddl.auto",hibernateUpate);
factoryBean.setJpaProperties(jpaProperties);
return factoryBean;
}
示例2: entityManagerFactory
import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter; //导入方法依赖的package包/类
@Bean
public EntityManagerFactory entityManagerFactory() {
HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
vendorAdapter.setDatabase(Database.H2);
vendorAdapter.setGenerateDdl(jpaGenerateDdl);
vendorAdapter.setShowSql(jpaShowSql);
LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean();
factory.setJpaVendorAdapter(vendorAdapter);
factory.setPackagesToScan("org.bricket.b4.*.entity");
factory.setDataSource(dataSource());
factory.setJpaDialect(jpaDialect());
Map<String, String> jpaProperties = new HashMap<String, String>();
jpaProperties.put("hibernate.dialect", H2Dialect.class.getName());
jpaProperties.put("hibernate.cache.region.factory_class", EhCacheRegionFactory.class.getName());
jpaProperties.put("hibernate.cache.use_second_level_cache", "true");
jpaProperties.put("hibernate.cache.use_query_cache", "true");
jpaProperties.put("hibernate.cache.use_minimal_puts", "true");
factory.setJpaPropertyMap(jpaProperties);
factory.afterPropertiesSet();
return factory.getObject();
}
示例3: entityManagerFactory
import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter; //导入方法依赖的package包/类
@Bean
public EntityManagerFactory entityManagerFactory() throws SQLException {
HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
// vendorAdapter.setGenerateDdl(true); // Crea la tabella e le colonne quando non esistono
vendorAdapter.setShowSql(config.getShowSql());
vendorAdapter.setDatabasePlatform("org.hibernate.dialect.MySQL5InnoDBDialect");
LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean();
factory.setJpaVendorAdapter(vendorAdapter);
List<String> packages = config.getDbEntityPackages();
packages.add("net.yadaframework.persistence.entity");
packages.add("net.yadaframework.security.persistence.entity");
packages.add("net.yadaframework.cms.persistence.entity");
packages.add("net.yadaframework.commerce.persistence.entity");
log.info("Scanning packages for entities: {}", StringUtils.join(packages, ","));
factory.setPackagesToScan(packages.toArray(new String[]{}));
factory.setDataSource(dataSource());
factory.afterPropertiesSet();
return factory.getObject();
}
示例4: entityManagerFactory
import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter; //导入方法依赖的package包/类
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
vendorAdapter.setGenerateDdl(false);
vendorAdapter.setDatabase(Database.H2);
vendorAdapter.setShowSql(false);
LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean();
factory.setJpaVendorAdapter(vendorAdapter);
factory.setPackagesToScan("jdblender.sdata.model");
factory.setDataSource(dataSourceH2());
Map<String, Object> props = factory.getJpaPropertyMap();
props.put("hibernate.cache.use_query_cache", "false");
props.put("hibernate.cache.use_second_level_cache", "false");
props.put("hibernate.hbm2ddl.auto", "validate");
//props.put("hibernate.jdbc.batch_size", "100");
//props.put("hibernate.cache.use_second_level_cache", "false");
//props.put("hibernate.order_inserts", "1");
//props.put("hibernate.order_updates", "1");
factory.setJpaPropertyMap(props);
return factory;
}
示例5: entityManagerFactory
import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter; //导入方法依赖的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;
}
示例6: entityManagerFactory
import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter; //导入方法依赖的package包/类
@Bean(name = "postgresEntityManagerFactory")
public EntityManagerFactory entityManagerFactory() {
HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
vendorAdapter.setGenerateDdl(false);
vendorAdapter.setShowSql(true);
LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean();
factory.setJpaVendorAdapter(vendorAdapter);
factory.setPackagesToScan("org.sitenv.service.ccda.smartscorecard.entities.postgres");
Properties jpaProperties = new Properties();
jpaProperties.put("hibernate.hbm2ddl.auto", "none");
jpaProperties.put("hibernate.dialect", "org.hibernate.dialect.PostgreSQLDialect");
factory.setJpaProperties(jpaProperties);
factory.setDataSource(dataSource());
factory.afterPropertiesSet();
return factory.getObject();
}
示例7: entityManagerFactory
import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter; //导入方法依赖的package包/类
@Bean(name="inmemoryEntityManagerFactory")
@Primary
public EntityManagerFactory entityManagerFactory() {
HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
vendorAdapter.setGenerateDdl(false);
vendorAdapter.setShowSql(true);
LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean();
factory.setJpaVendorAdapter(vendorAdapter);
factory.setPackagesToScan("org.sitenv.service.ccda.smartscorecard.entities.inmemory");
Properties jpaProperties = new Properties();
jpaProperties.put("hibernate.hbm2ddl.auto", "none");
jpaProperties.put("hibernate.dialect", "org.hibernate.dialect.HSQLDialect");
jpaProperties.put("hibernate.format_sql", "true");
jpaProperties.put("hibernate.show_sql", "false");
factory.setDataSource(dataSource());
factory.setJpaProperties(jpaProperties);
factory.afterPropertiesSet();
return factory.getObject();
}
示例8: entityManagerFactory
import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter; //导入方法依赖的package包/类
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean();
HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
vendorAdapter.setGenerateDdl(Boolean.TRUE);
vendorAdapter.setShowSql(Boolean.TRUE);
factory.setDataSource(dataSource());
factory.setJpaVendorAdapter(vendorAdapter);
factory.setPackagesToScan("com.mastersheel007.springrestdemo");
Properties jpaProperties = new Properties();
jpaProperties.put("hibernate.hbm2ddl.auto", env.getProperty("hibernate.hbm2ddl.auto"));
factory.setJpaProperties(jpaProperties);
return factory;
}
示例9: entityManagerFactory
import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter; //导入方法依赖的package包/类
/**
* Creates EntityManagerFactory.
* @return LocalContainerEntityManagerFactoryBean
*/
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
HibernateJpaVendorAdapter hibernateJpa = new HibernateJpaVendorAdapter();
hibernateJpa.setDatabasePlatform("org.hibernate.dialect.PostgreSQLDialect");
hibernateJpa.setShowSql(false);
hibernateJpa.setGenerateDdl(true);
LocalContainerEntityManagerFactoryBean emf = new LocalContainerEntityManagerFactoryBean();
emf.setDataSource(dataSource);
emf.setPackagesToScan("pl.orange.labs");
emf.setJpaVendorAdapter(hibernateJpa);
emf.setJpaPropertyMap(Collections.singletonMap("javax.persistence.validation.mode", "none"));
emf.setPersistenceUnitName("Mundo");
return emf;
}
示例10: entityManagerFactory
import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter; //导入方法依赖的package包/类
@Bean
public EntityManagerFactory entityManagerFactory() {
HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
vendorAdapter.setGenerateDdl(false);
vendorAdapter.setShowSql(Boolean.valueOf(this.env.getRequiredProperty("spring.jpa.show-sql")));
//hibernate.dialect is resolved based on driver
//vendorAdapter.setDatabasePlatform(hibernateDialect);
LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean();
factory.setJpaVendorAdapter(vendorAdapter);
factory.setJpaProperties(getJPAProperties());
factory.setPackagesToScan("org.ohdsi.webapi");
factory.setDataSource(primaryDataSource());
factory.afterPropertiesSet();
return factory.getObject();
}
示例11: entityManagerFactory
import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter; //导入方法依赖的package包/类
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory(Environment env) throws Exception {
HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
vendorAdapter.setShowSql(Boolean.TRUE);
LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean();
factory.setPersistenceUnitName("sample");
factory.setJpaVendorAdapter(vendorAdapter);
factory.setPackagesToScan("ch.thp.proto.spring.time");
factory.setDataSource(dataSource(env));
factory.setJpaProperties(jpaProperties());
return factory;
}
示例12: entityManagerFactoryBean
import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter; //导入方法依赖的package包/类
/**
* @return the JPA entity manager
*/
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactoryBean() {
final LocalContainerEntityManagerFactoryBean factoryBean = new LocalContainerEntityManagerFactoryBean();
factoryBean.setDataSource(this.defaultDataSource());
factoryBean.setPackagesToScan(new String[] { "com.teefun.db" });
final HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
vendorAdapter.setShowSql(true);
vendorAdapter.setGenerateDdl(true);
factoryBean.setJpaVendorAdapter(vendorAdapter);
factoryBean.setJpaProperties(this.hibernateProperties());
return factoryBean;
}
示例13: entityManagerFactory
import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter; //导入方法依赖的package包/类
@Bean(name="entityManagerFactory")
public EntityManagerFactory entityManagerFactory() {
HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
vendorAdapter.setDatabase(Database.H2);
vendorAdapter.setGenerateDdl(false);
vendorAdapter.setShowSql(true);
LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean();
factory.setJpaVendorAdapter(vendorAdapter);
factory.setPackagesToScan("net.eusashead.bjugquerydsl.data");
factory.setDataSource(dataSource());
factory.afterPropertiesSet();
return factory.getObject();
}
示例14: newHibernateJpaVendorAdapter
import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter; //导入方法依赖的package包/类
/**
* New hibernate jpa vendor adapter.
*
* @param databaseProperties the database properties
* @return the hibernate jpa vendor adapter
*/
public static HibernateJpaVendorAdapter newHibernateJpaVendorAdapter(final DatabaseProperties databaseProperties) {
final HibernateJpaVendorAdapter bean = new HibernateJpaVendorAdapter();
bean.setGenerateDdl(databaseProperties.isGenDdl());
bean.setShowSql(databaseProperties.isShowSql());
return bean;
}
示例15: entityManagerFactory
import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter; //导入方法依赖的package包/类
@Bean
public FactoryBean<EntityManagerFactory> entityManagerFactory() {
LocalContainerEntityManagerFactoryBean emf = new LocalContainerEntityManagerFactoryBean();
emf.setDataSource(dataSource());
HibernateJpaVendorAdapter va = new HibernateJpaVendorAdapter();
va.setShowSql(true);
emf.setJpaVendorAdapter(va);
emf.setPackagesToScan(TestJpaDomain.class.getPackage().getName());
emf.setPersistenceUnitName("test");
return emf;
}
开发者ID:holon-platform,项目名称:holon-datastore-jpa-querydsl,代码行数:15,代码来源:TestJpaQueryDslDatastoreHibernate.java