Java Code Examples for org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter#setShowSql()

The following examples show how to use org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter#setShowSql() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RepositorySpringConfiguration.java    From personal_book_library_web_project with MIT License 7 votes vote down vote up
@Bean
public EntityManagerFactory entityManagerFactory() throws SQLException {

	HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
	vendorAdapter.setGenerateDdl(true);
	vendorAdapter.setShowSql(true);

	LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean();
	factory.setJpaVendorAdapter(vendorAdapter);
	factory.setPackagesToScan("com.personal.book.library.datalayer.entity", 
							 "com.personal.book.library.datalayer.repository.jpa");
	factory.setDataSource(dataSource());
	factory.afterPropertiesSet();
	factory.setJpaProperties(jpaProperties());
	
	return factory.getObject();
}
 
Example 2
Source File: RepositoryConfiguration.java    From java-platform with Apache License 2.0 5 votes vote down vote up
@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.whenling");
		factory.setJpaDialect(new HibernateJpaDialect());

		Properties jpaProperties = new Properties();
		jpaProperties.put("hibernate.id.new_generator_mappings", false);
		jpaProperties.put("hibernate.hbm2ddl.auto", hibernateHbm2ddlAuto);
		jpaProperties.put("hibernate.dialect", hibernateDialect);
		jpaProperties.put("hibernate.show_sql", hibernateShowSql);
		jpaProperties.put("hibernate.format_sql", hibernateFormatSql);
		jpaProperties.put("hibernate.current_session_context_class", hibernateCurrentSessionContextClass);

		jpaProperties.put("javax.persistence.validation.mode", javaxPersistenceValidationMode);
		jpaProperties.put("hibernate.query.substitutions", hibernateQuerySubstitutions);
		jpaProperties.put("hibernate.default_batch_fetch_size", hibernateDefaultBatchFetchSize);
		jpaProperties.put("hibernate.max_fetch_depth", hibernateMaxFetchDepth);
		jpaProperties.put("hibernate.enable_lazy_load_no_trans", hibernateEnableLazyLoadNoTrans);
		jpaProperties.put("hibernate.bytecode.use_reflection_optimizer", hibernateBytecodeUseReflectionOptimizer);

		jpaProperties.put("hibernate.cache.use_second_level_cache", hibernateCacheUseSecondLevelCache);
		jpaProperties.put("hibernate.cache.region.factory_class", hibernateCacheInfinispanRegionFactoryClass);
//		jpaProperties.put("hibernate.cache.infinispan.cfg", hibernateCacheInfinispanCfg);
		jpaProperties.put("javax.persistence.sharedCache.mode", javaxPersistenceSharedCacheMode);
		jpaProperties.put("hibernate.generate_statistics", hibernateGenerateStatistics);

		jpaProperties.put("hibernate.cache.use_query_cache", hibernateCacheUseQueryCache);
		factory.setJpaProperties(jpaProperties);

		return factory;
	}
 
Example 3
Source File: EngineTest.java    From score with Apache License 2.0 5 votes vote down vote up
@Bean
JpaVendorAdapter jpaVendorAdapter() {
    HibernateJpaVendorAdapter adapter = new HibernateJpaVendorAdapter();
    adapter.setShowSql(false);
    adapter.setGenerateDdl(true);
    return adapter;
}
 
Example 4
Source File: WorkerNodeServiceTest.java    From score with Apache License 2.0 5 votes vote down vote up
@Bean
JpaVendorAdapter jpaVendorAdapter() {
    HibernateJpaVendorAdapter adapter = new HibernateJpaVendorAdapter();
    adapter.setShowSql(SHOW_SQL);
    adapter.setGenerateDdl(true);
    return adapter;
}
 
Example 5
Source File: VersionRepositoryTest.java    From score with Apache License 2.0 5 votes vote down vote up
@Bean
JpaVendorAdapter jpaVendorAdapter() {
    HibernateJpaVendorAdapter adapter = new HibernateJpaVendorAdapter();
    adapter.setShowSql(SHOW_SQL);
    adapter.setGenerateDdl(true);
    return adapter;
}
 
Example 6
Source File: PartitionTemplateWithEmfTest.java    From score with Apache License 2.0 5 votes vote down vote up
@Bean
JpaVendorAdapter jpaVendorAdapter() {
    HibernateJpaVendorAdapter adapter = new HibernateJpaVendorAdapter();
    adapter.setShowSql(SHOW_SQL);
    adapter.setGenerateDdl(true);
    return adapter;
}
 
Example 7
Source File: ExecutionStateRepositoryTest.java    From score with Apache License 2.0 5 votes vote down vote up
@Bean
JpaVendorAdapter jpaVendorAdapter() {
    HibernateJpaVendorAdapter adapter = new HibernateJpaVendorAdapter();
    adapter.setShowSql(true);
    adapter.setGenerateDdl(true);
    return adapter;
}
 
Example 8
Source File: PersistenceConfig.java    From AIDR with GNU Affero General Public License v3.0 5 votes vote down vote up
@Bean
public JpaVendorAdapter jpaVendorAdapter() {
	final HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
	vendorAdapter.setDatabase(Database.MYSQL);
	vendorAdapter.setDatabasePlatform(dialect);
	vendorAdapter.setShowSql(false);
	vendorAdapter.setGenerateDdl(true);
	return vendorAdapter;
}
 
Example 9
Source File: MainConfig.java    From spring-boot-jta-atomikos-sample with Apache License 2.0 5 votes vote down vote up
@Bean
public JpaVendorAdapter jpaVendorAdapter() {
	HibernateJpaVendorAdapter hibernateJpaVendorAdapter = new HibernateJpaVendorAdapter();
	hibernateJpaVendorAdapter.setShowSql(true);
	hibernateJpaVendorAdapter.setGenerateDdl(true);
	hibernateJpaVendorAdapter.setDatabase(Database.MYSQL);
	return hibernateJpaVendorAdapter;
}
 
Example 10
Source File: AbstractJpaConfiguration.java    From abixen-platform with GNU Lesser General Public License v2.1 5 votes vote down vote up
private JpaVendorAdapter jpaVendorAdapter() {

        HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
        vendorAdapter.setGenerateDdl(false);
        vendorAdapter.setShowSql(false);
        return vendorAdapter;
    }
 
Example 11
Source File: DatabaseConfiguration.java    From flowable-engine with Apache License 2.0 5 votes vote down vote up
@Bean(name = "entityManagerFactory")
public EntityManagerFactory entityManagerFactory(DataSource dataSource) {
    LocalContainerEntityManagerFactoryBean entityManagerFactoryBean = new LocalContainerEntityManagerFactoryBean();
    entityManagerFactoryBean.setDataSource(dataSource);
    entityManagerFactoryBean.setPackagesToScan("org.flowable.rest.api.jpa.model");
    entityManagerFactoryBean.setPersistenceUnitName("test");
    HibernateJpaVendorAdapter hibernateJpaVendorAdapter = new HibernateJpaVendorAdapter();
    hibernateJpaVendorAdapter.setShowSql(false);
    hibernateJpaVendorAdapter.setGenerateDdl(true);
    hibernateJpaVendorAdapter.setDatabase(Database.H2);
    entityManagerFactoryBean.setJpaVendorAdapter(hibernateJpaVendorAdapter);
    entityManagerFactoryBean.afterPropertiesSet();
    return entityManagerFactoryBean.getObject();
}
 
Example 12
Source File: JpaConfig.java    From Project with Apache License 2.0 5 votes vote down vote up
@Bean
public JpaVendorAdapter jpaVendorAdapter() {
  HibernateJpaVendorAdapter adapter = new HibernateJpaVendorAdapter();
  adapter.setDatabase(Database.H2);
  adapter.setShowSql(true);
  adapter.setGenerateDdl(false);
  adapter.setDatabasePlatform("org.hibernate.dialect.H2Dialect");
  return adapter;
}
 
Example 13
Source File: AppConfig.java    From Spring-Framework-Essentials with MIT License 5 votes vote down vote up
@Bean
public JpaVendorAdapter jpaVendorAdapter() {
    HibernateJpaVendorAdapter adapter = new HibernateJpaVendorAdapter();
    adapter.setShowSql(true);
    adapter.setGenerateDdl(true);
    adapter.setDatabase(Database.MYSQL);
    return adapter;
}
 
Example 14
Source File: AppConfig.java    From Spring-Framework-Essentials with MIT License 5 votes vote down vote up
@Bean
public JpaVendorAdapter jpaVendorAdapter() {
    HibernateJpaVendorAdapter adapter = new HibernateJpaVendorAdapter();
    adapter.setShowSql(true);
    adapter.setGenerateDdl(true);
    adapter.setDatabase(Database.H2);
    adapter.setDatabasePlatform("org.hibernate.dialect.H2Dialect");
    return adapter;
}
 
Example 15
Source File: OrmRepository.java    From sample-boot-micro with MIT License 5 votes vote down vote up
private JpaVendorAdapter vendorAdapter() {
    HibernateJpaVendorAdapter adapter = new HibernateJpaVendorAdapter();
    adapter.setShowSql(isShowSql());
    if (getDatabase() != null) {
        adapter.setDatabase(getDatabase());
    }
    adapter.setDatabasePlatform(getDatabasePlatform());
    adapter.setGenerateDdl(isGenerateDdl());
    return adapter;
}
 
Example 16
Source File: Application.java    From JPA-Specifications-Example with Apache License 2.0 5 votes vote down vote up
@Bean
public JpaVendorAdapter jpaVendorAdapter() {
	HibernateJpaVendorAdapter hibernateJpaVendorAdapter = new HibernateJpaVendorAdapter();
	hibernateJpaVendorAdapter.setShowSql(false);
	hibernateJpaVendorAdapter.setGenerateDdl(true);
	hibernateJpaVendorAdapter.setDatabase(Database.H2);
	return hibernateJpaVendorAdapter;
}
 
Example 17
Source File: DatabaseConfiguration.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
@Bean(name = "entityManagerFactory")
public EntityManagerFactory entityManagerFactory() {
  LocalContainerEntityManagerFactoryBean entityManagerFactoryBean = new LocalContainerEntityManagerFactoryBean();
  entityManagerFactoryBean.setDataSource(dataSource());
  entityManagerFactoryBean.setPackagesToScan("org.activiti.rest.api.jpa.model");
  entityManagerFactoryBean.setPersistenceUnitName("test");
  HibernateJpaVendorAdapter hibernateJpaVendorAdapter = new HibernateJpaVendorAdapter();
  hibernateJpaVendorAdapter.setShowSql(false);
  hibernateJpaVendorAdapter.setGenerateDdl(true);
  hibernateJpaVendorAdapter.setDatabase(Database.H2);
  entityManagerFactoryBean.setJpaVendorAdapter(hibernateJpaVendorAdapter);
  entityManagerFactoryBean.afterPropertiesSet();
  return entityManagerFactoryBean.getObject();
}
 
Example 18
Source File: JpaCoreConfig.java    From bearchoke with Apache License 2.0 5 votes vote down vote up
@Bean
public JpaVendorAdapter jpaVendorAdapter() {
    HibernateJpaVendorAdapter hibernateJpaVendorAdapter = new HibernateJpaVendorAdapter();
    hibernateJpaVendorAdapter.setShowSql(false);
    hibernateJpaVendorAdapter.setGenerateDdl(true);
    hibernateJpaVendorAdapter.setDatabasePlatform(environment.getProperty("jpa.dialect"));

    return hibernateJpaVendorAdapter;
}
 
Example 19
Source File: DatabaseConfig.java    From cloudbreak with Apache License 2.0 5 votes vote down vote up
@Bean
public JpaVendorAdapter jpaVendorAdapter() {
    HibernateJpaVendorAdapter hibernateJpaVendorAdapter = new HibernateJpaVendorAdapter();
    hibernateJpaVendorAdapter.setShowSql(true);
    hibernateJpaVendorAdapter.setDatabase(Database.POSTGRESQL);
    return hibernateJpaVendorAdapter;
}
 
Example 20
Source File: DatabaseConfig.java    From cloudbreak with Apache License 2.0 5 votes vote down vote up
@Bean
public JpaVendorAdapter jpaVendorAdapter() {
    HibernateJpaVendorAdapter hibernateJpaVendorAdapter = new HibernateJpaVendorAdapter();
    hibernateJpaVendorAdapter.setShowSql(true);
    hibernateJpaVendorAdapter.setDatabase(Database.POSTGRESQL);
    return hibernateJpaVendorAdapter;
}