Example usage for org.springframework.orm.jpa.vendor HibernateJpaVendorAdapter setShowSql

List of usage examples for org.springframework.orm.jpa.vendor HibernateJpaVendorAdapter setShowSql

Introduction

In this page you can find the example usage for org.springframework.orm.jpa.vendor HibernateJpaVendorAdapter setShowSql.

Prototype

public void setShowSql(boolean showSql) 

Source Link

Document

Set whether to show SQL in the log (or in the console).

Usage

From source file:com.ipet.server.config.JPAConfiguration.java

@Bean
public JpaVendorAdapter jpaVendorAdapter() {
    HibernateJpaVendorAdapter jpaVendorAdapter = new HibernateJpaVendorAdapter();

    jpaVendorAdapter.setDatabase(Database.MYSQL);
    jpaVendorAdapter.setGenerateDdl(true);
    jpaVendorAdapter.setShowSql(true);
    jpaVendorAdapter.setDatabasePlatform("org.hibernate.dialect.MySQL5Dialect");

    //return jpaVendorAdapter;
    return null;//from   w ww  .  java 2 s.  c o  m
}

From source file:com.sh.connection.InfrastructureConfig.java

/**
 * Sets up a {@link LocalContainerEntityManagerFactoryBean} to use Hibernate. Activates picking up entities from the
 * project's base package.// w w  w .  j av a  2s  .  c  om
 *
 * @return
 */
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {

    HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
    vendorAdapter.setDatabase(Database.HSQL);
    vendorAdapter.setGenerateDdl(true);
    vendorAdapter.setShowSql(true);

    LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean();
    factory.setJpaVendorAdapter(vendorAdapter);
    factory.setPackagesToScan(getClass().getPackage().getName());
    factory.setDataSource(dataSource());

    return factory;
}

From source file:org.raistlic.spring.test.flyway.FlywayTestConfiguration.java

@Bean
public JpaVendorAdapter jpaVendorAdapter() {

    HibernateJpaVendorAdapter jpaVendorAdapter = new HibernateJpaVendorAdapter();
    jpaVendorAdapter.setDatabase(Database.DERBY);
    jpaVendorAdapter.setGenerateDdl(false);
    jpaVendorAdapter.setShowSql(true);
    return jpaVendorAdapter;
}

From source file:net.ljcomputing.sr.config.JpaConfiguration.java

/**
 * Configured JPA vendor adapter bean.// ww  w .jav a2  s  .  com
 *
 * @return the jpa vendor adapter
 */
@Bean
public JpaVendorAdapter jpaVendorAdapter() {
    HibernateJpaVendorAdapter hibernateJpaVendorAdapter = new HibernateJpaVendorAdapter();
    hibernateJpaVendorAdapter.setShowSql(false);
    hibernateJpaVendorAdapter.setGenerateDdl(true);
    hibernateJpaVendorAdapter.setDatabase(Database.MYSQL);
    return hibernateJpaVendorAdapter;
}

From source file:uk.ac.ebi.ep.data.testConfig.SpringDataMockConfig.java

@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {

    Properties properties = new Properties();
    properties.setProperty("hibernate.cache.provider_class", "org.hibernate.cache.NoCacheProvider");
    properties.setProperty("hibernate.format_sql", "true");
    properties.setProperty(" hibernate.dialect", "org.hibernate.dialect.H2Dialect");
    //properties.setProperty("hibernate.hbm2ddl.auto", "create-drop");
    //properties.setProperty("hibernate.ejb.naming_strategy", "org.hibernate.cfg.ImprovedNamingStrategy");
    properties.setProperty("spring.jpa.hibernate.ddl-auto", "update");

    HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
    vendorAdapter.setDatabase(Database.H2);
    vendorAdapter.setGenerateDdl(true);/*from  w  ww  .jav  a  2  s . co  m*/
    vendorAdapter.setShowSql(false);

    LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean();
    factory.setJpaVendorAdapter(vendorAdapter);
    factory.setJpaProperties(properties);
    factory.setPackagesToScan("uk.ac.ebi.ep.data.domain");
    factory.setDataSource(dataSource());

    return factory;
}

From source file:gov.nih.nci.integration.dao.JpaConfig.java

/**
 * Hiberante Jpa vendor adapter.//from   www  .j a  v  a2 s.  c o  m
 * 
 * @return the hibernate jpa vendor adapter
 */
@Bean
public HibernateJpaVendorAdapter jpaVendorAdapter() {
    final HibernateJpaVendorAdapter jpaVendorAdapter = new HibernateJpaVendorAdapter();
    jpaVendorAdapter.setDatabasePlatform(databasePlatform);
    jpaVendorAdapter.setShowSql(showSql);

    return jpaVendorAdapter;
}

From source file:com.activiti.conf.DatabaseConfiguration.java

@Bean
public JpaVendorAdapter jpaVendorAdapter() {
    HibernateJpaVendorAdapter jpaVendorAdapter = new HibernateJpaVendorAdapter();
    jpaVendorAdapter.setShowSql(env.getProperty("hibernate.show_sql", Boolean.class, false));
    jpaVendorAdapter/*  w w  w.  j a v  a 2s. co m*/
            .setDatabasePlatform(env.getProperty("hibernate.dialect", "org.hibernate.dialect.H2Dialect"));
    return jpaVendorAdapter;
}

From source file:it.f2informatica.mysql.MySQLApplicationConfig.java

@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
    HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
    vendorAdapter.setDatabase(Database.MYSQL);
    vendorAdapter.setGenerateDdl(false);
    vendorAdapter.setShowSql(true);

    LocalContainerEntityManagerFactoryBean factoryBean = new LocalContainerEntityManagerFactoryBean();
    factoryBean.setPersistenceUnitName(Persistence.PERSISTENCE_UNIT_NAME);
    factoryBean.setJpaVendorAdapter(vendorAdapter);
    factoryBean.setPackagesToScan(DOMAIN_PACKAGE);
    factoryBean.setDataSource(dataSource());
    return factoryBean;
}

From source file:org.thingsplode.server.JpaConfig.java

@Bean
public EntityManagerFactory entityManagerFactory() throws PropertyVetoException, SQLException {
    HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
    vendorAdapter.setGenerateDdl(env.getProperty("hibernate.generate.ddl", Boolean.class));
    vendorAdapter.setShowSql(env.getProperty("hibernate.show.sql", Boolean.class));

    LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean();
    factory.setJpaVendorAdapter(vendorAdapter);

    factory.setPackagesToScan(Bootstrap.ENTITIES, Device.class.getPackage().getName());

    factory.setDataSource(dataSource());
    factory.setJpaProperties(getProperties());
    factory.afterPropertiesSet();//from w  w w . j  a v a  2  s  .c om
    return factory.getObject();
}

From source file:com.MockGatewayApplication.java

@Bean
public JpaVendorAdapter jpaVendorAdapter() {
    HibernateJpaVendorAdapter adapter = new HibernateJpaVendorAdapter();
    adapter.setDatabase(Database.valueOf(dbType));
    adapter.setShowSql(true);
    adapter.setGenerateDdl(true);//from   w ww .j a  va 2s  . c  o  m
    adapter.setDatabasePlatform(dbDialect);
    return adapter;
}