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

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

Introduction

In this page you can find the example usage for org.springframework.orm.jpa.vendor EclipseLinkJpaVendorAdapter 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:se.ivankrizsan.messagecowboy.testconfig.PersistenceTestConfiguration.java

/**
 * JPA entity manager factory bean.//  w w w.java  2 s  .  co  m
 */
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
    /* JPA entity manager factory. */
    final LocalContainerEntityManagerFactoryBean theJpaEntityManagerFactory = new LocalContainerEntityManagerFactoryBean();
    theJpaEntityManagerFactory.setDataSource(dataSource());
    theJpaEntityManagerFactory.setPersistenceUnitName("message-cowboy");
    theJpaEntityManagerFactory.setJpaProperties(jpaProperties());

    /* JPA vendor adapter. */
    final EclipseLinkJpaVendorAdapter theJpaVendorAdapter = new EclipseLinkJpaVendorAdapter();
    theJpaVendorAdapter.setShowSql(true);

    theJpaEntityManagerFactory.setJpaVendorAdapter(theJpaVendorAdapter);

    return theJpaEntityManagerFactory;
}

From source file:com.app.config.App2Config.java

@Bean(name = "appEntityManagerFactory")
public EntityManagerFactory entityManagerFactory() {
    LocalContainerEntityManagerFactoryBean lef = new LocalContainerEntityManagerFactoryBean();
    lef.setDataSource(dataSource());/*w  ww  . j a v a 2  s. c  om*/

    EclipseLinkJpaVendorAdapter vendor = new EclipseLinkJpaVendorAdapter();
    vendor.setShowSql(true);
    vendor.setGenerateDdl(true);
    vendor.setDatabase(Database.MYSQL);
    lef.setJpaVendorAdapter(vendor);
    //lef.setJpaVendorAdapter(jpaVendorAdapter);
    //lef.setPackagesToScan("com.app.jparepo");
    //lef.setPersistenceUnitName("barPersistenceUnit");
    //lef.afterPropertiesSet();
    return lef.getObject();
}

From source file:ru.langboost.config.DBConfig.java

@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
    EclipseLinkJpaVendorAdapter vendorAdapter = new EclipseLinkJpaVendorAdapter();
    vendorAdapter.setGenerateDdl(true);//from   w  w  w  .j  a v  a2 s.co  m
    vendorAdapter.setShowSql(true);

    LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean();
    factory.setJpaVendorAdapter(vendorAdapter);
    factory.setPackagesToScan(Environment.BASE_PACKAGE);
    factory.setDataSource(dataSource());
    factory.setJpaProperties(jpaProperties());
    return factory;
}

From source file:fr.univlorraine.mondossierweb.config.JpaConfigApogee.java

/**
 * EntityManager Factory//  w w  w  .  j  a  v  a 2s  .com
 * @return
 */
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactoryApogee() {
    LocalContainerEntityManagerFactoryBean localContainerEntityManagerFactoryBean = new LocalContainerEntityManagerFactoryBean();
    localContainerEntityManagerFactoryBean.setPersistenceUnitName(PERSISTENCE_UNIT_NAME);
    localContainerEntityManagerFactoryBean.setPackagesToScan(VObjSeApogee.class.getPackage().getName());
    localContainerEntityManagerFactoryBean.setDataSource(dataSourceApogee());
    localContainerEntityManagerFactoryBean.setJpaDialect(new EclipseLinkJpaDialect());

    Properties jpaProperties = new Properties();
    /* Active le static weaving d'EclipseLink */
    jpaProperties.put(PersistenceUnitProperties.WEAVING, "static");
    /* Dsactive le cache partag */
    jpaProperties.put(PersistenceUnitProperties.CACHE_SHARED_DEFAULT, String.valueOf(false));
    localContainerEntityManagerFactoryBean.setSharedCacheMode(SharedCacheMode.NONE);
    localContainerEntityManagerFactoryBean.setJpaProperties(jpaProperties);

    EclipseLinkJpaVendorAdapter jpaVendorAdapter = new EclipseLinkJpaVendorAdapter();
    jpaVendorAdapter.setGenerateDdl(false);
    jpaVendorAdapter.setShowSql(false);
    localContainerEntityManagerFactoryBean.setJpaVendorAdapter(jpaVendorAdapter);

    return localContainerEntityManagerFactoryBean;
}

From source file:se.ivankrizsan.messagecowboy.PersistenceConfiguration.java

/**
 * JPA entity manager factory bean./*from w w w. j  a v a 2  s .co m*/
 * Depends on the hsqlDbServer bean, in order to create the embedded
 * database, if one is to be used, before the entity manager factory.
 */
@Bean
@DependsOn("hsqlDbServer")
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
    /* JPA entity manager factory. */
    final LocalContainerEntityManagerFactoryBean theJpaEntityManagerFactory = new LocalContainerEntityManagerFactoryBean();
    theJpaEntityManagerFactory.setDataSource(dataSource());
    theJpaEntityManagerFactory.setPersistenceUnitName("message-cowboy");
    theJpaEntityManagerFactory.setJpaProperties(jpaProperties());

    /* JPA vendor adapter. */
    final EclipseLinkJpaVendorAdapter theJpaVendorAdapter = new EclipseLinkJpaVendorAdapter();
    theJpaVendorAdapter.setShowSql(true);

    theJpaEntityManagerFactory.setJpaVendorAdapter(theJpaVendorAdapter);

    return theJpaEntityManagerFactory;
}

From source file:fr.univlorraine.mondossierweb.config.JpaConfig.java

/**
 * EntityManager Factory/*from w ww  . j  av a 2  s. c o  m*/
 * @return
 */
@Bean
@DependsOn("flyway")
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
    LocalContainerEntityManagerFactoryBean localContainerEntityManagerFactoryBean = new LocalContainerEntityManagerFactoryBean();
    localContainerEntityManagerFactoryBean.setPersistenceUnitName(PERSISTENCE_UNIT_NAME);
    localContainerEntityManagerFactoryBean.setPackagesToScan(Favoris.class.getPackage().getName());
    localContainerEntityManagerFactoryBean.setDataSource(dataSource());
    localContainerEntityManagerFactoryBean.setJpaDialect(new EclipseLinkJpaDialect());

    Properties jpaProperties = new Properties();
    /* Active le static weaving d'EclipseLink */
    jpaProperties.put(PersistenceUnitProperties.WEAVING, "static");
    /* Dsactive le cache partag */
    jpaProperties.put(PersistenceUnitProperties.CACHE_SHARED_DEFAULT, String.valueOf(false));
    localContainerEntityManagerFactoryBean.setJpaProperties(jpaProperties);

    EclipseLinkJpaVendorAdapter jpaVendorAdapter = new EclipseLinkJpaVendorAdapter();
    jpaVendorAdapter.setGenerateDdl(false);
    jpaVendorAdapter.setShowSql(false);
    localContainerEntityManagerFactoryBean.setJpaVendorAdapter(jpaVendorAdapter);

    return localContainerEntityManagerFactoryBean;
}

From source file:org.fon.documentmanagementsystem.config.AppConfig.java

@Bean
public EclipseLinkJpaVendorAdapter eclipseLinkJpaVendorAdapter() {
    EclipseLinkJpaVendorAdapter vendorAdapter = new EclipseLinkJpaVendorAdapter();
    vendorAdapter.setDatabasePlatform("org.eclipse.persistence.platform.database.MySQLPlatform");
    vendorAdapter.setDatabase(Database.MYSQL);
    vendorAdapter.setShowSql(true);
    return vendorAdapter;
}

From source file:cz.lbenda.coursing.client.ClientAppConfig.java

public @Bean EntityManagerFactory entityManagerFactory() {
    try {/*from  ww  w.java 2s  . c o m*/
        EclipseLinkJpaVendorAdapter vendorAdapter = new EclipseLinkJpaVendorAdapter();
        vendorAdapter.setDatabasePlatform("org.eclipse.persistence.platform.database.H2Platform");
        vendorAdapter.setShowSql(true);
        vendorAdapter.setGenerateDdl(true);
        EclipseLinkJpaDialect dialect = new EclipseLinkJpaDialect();
        dialect.setLazyDatabaseTransaction(true);

        LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean();
        factory.setJpaVendorAdapter(vendorAdapter);
        factory.setJpaDialect(dialect);
        factory.setPackagesToScan("cz.lbenda.coursing");
        factory.setDataSource(dataSource());
        factory.setPersistenceXmlLocation("classpath*:META-INF/persistence.xml");
        factory.setPersistenceUnitName("coursing");

        /*
        Map<String, String> prop = new HashMap<>();
        prop.put("eclipselink.deploy-on-startup", "true");
        prop.put("eclipselink.ddl-generation", "create-or-extend-tables");
        prop.put("eclipselink.ddl-generation.output-mode", "database");
        prop.put("eclipselink.create-ddl-jdbc-file-name", "create.sql");
        prop.put("eclipselink.weaving", "static");
        prop.put("eclipselink.weaving.lazy", "true");
        prop.put("eclipselink.weaving.internal", "true");
        prop.put("eclipselink.logging.level", "SEVERE");
        prop.put("eclipselink.query-results-cache.type", "WEAK");
        prop.put("eclipselink.jdbc.batch-writing", "JDBC");
        prop.put("eclipselink.jdbc.batch-writing.size", "1000");
                
        factory.setJpaPropertyMap(prop);
        */

        // factory.setLoadTimeWeaver(new InstrumentationLoadTimeWeaver());
        factory.afterPropertiesSet();

        return factory.getObject();
    } catch (Exception e) {
        LOG.trace("Faild create entityManagerFactory", e);
        throw new RuntimeException("Faild create entityManagerFactory", e);
    }
}

From source file:ren.hankai.cordwood.data.jpa.config.JpaDataSourceInfo.java

/**
 * JPA?/*from w ww  .  jav a2s . c o m*/
 *
 * @param showSql ??sql?
 * @return ?
 * @author hankai
 * @since Mar 29, 2018 10:59:51 PM
 */
public AbstractJpaVendorAdapter createJpaVendorAdapter(boolean showSql) {
    final EclipseLinkJpaVendorAdapter adapter = new EclipseLinkJpaVendorAdapter();
    adapter.setDatabasePlatform(this.databasePlatform);
    adapter.setShowSql(showSql);
    return adapter;
}