Example usage for javax.persistence SharedCacheMode NONE

List of usage examples for javax.persistence SharedCacheMode NONE

Introduction

In this page you can find the example usage for javax.persistence SharedCacheMode NONE.

Prototype

SharedCacheMode NONE

To view the source code for javax.persistence SharedCacheMode NONE.

Click Source Link

Document

Caching is disabled for the persistence unit.

Usage

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

/**
 * EntityManager Factory/*from   w  ww  .  ja  va 2 s . co m*/
 * @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;
}