org.broadleafcommerce.common.extensibility.jpa
Class JPAPropertiesPersistenceUnitPostProcessor

java.lang.Object
  extended by org.broadleafcommerce.common.extensibility.jpa.JPAPropertiesPersistenceUnitPostProcessor
All Implemented Interfaces:
org.springframework.orm.jpa.persistenceunit.PersistenceUnitPostProcessor

public class JPAPropertiesPersistenceUnitPostProcessor
extends Object
implements org.springframework.orm.jpa.persistenceunit.PersistenceUnitPostProcessor

This class allows us to override Persistence Unit properties on a per-environment basis. Spring's PersistenceUnitManager allows us to pass in a list of PersistenceUnitPostProcessors. This class will allow us to override or add custom JPA properties to the Persistence Unit. This is useful when different environments have different requirements for JPA properties. The best example of this is SQL Dialect. You may want to use a dialect such as Oracle for production and test environments, and perhaps HSQLDB for local and integration testing. You can set the dialect property using the RuntimeEnvironmentPropertiesConfigurer. The keys will be the same in each environment, but the values would be defined the environment-specific properties files. If you want the property to be added only to certain environments, add the value "null" to the properties file. For example: classpath*:/META-INF/mycompany_persistence.xml


Field Summary
protected  String blCMSStorageHibernateCacheUse_query_cache
           
protected  String blCMSStorageHibernateCacheUse_second_level_cache
           
protected  String blCMSStorageHibernateDialect
           
protected  String blCMSStorageHibernateHbm2ddlAuto
           
protected  String blCMSStorageHibernateHbm2ddlImport_files
           
protected  String blCMSStorageHibernateShow_sql
           
protected  String blPUHibernateCacheUse_query_cache
           
protected  String blPUHibernateCacheUse_second_level_cache
           
protected  String blPUHibernateDialect
           
protected  String blPUHibernateHbm2ddlAuto
           
protected  String blPUHibernateHbm2ddlImport_files
           
protected  String blPUHibernateShow_sql
           
protected  String blSecurePUHibernateCacheUse_query_cache
           
protected  String blSecurePUHibernateCacheUse_second_level_cache
           
protected  String blSecurePUHibernateDialect
           
protected  String blSecurePUHibernateHbm2ddlAuto
           
protected  String blSecurePUHibernateHbm2ddlImport_files
           
protected  String blSecurePUHibernateShow_sql
           
protected  Map<String,String> overrideProperties
           
protected  Map<String,String> persistenceUnitProperties
           
 
Constructor Summary
JPAPropertiesPersistenceUnitPostProcessor()
           
 
Method Summary
 void populatePresetProperties()
           
 void postProcessPersistenceUnitInfo(org.springframework.orm.jpa.persistenceunit.MutablePersistenceUnitInfo pui)
           
 void setPersistenceUnitProperties(Map<String,String> properties)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

persistenceUnitProperties

protected Map<String,String> persistenceUnitProperties

overrideProperties

protected Map<String,String> overrideProperties

blPUHibernateHbm2ddlAuto

@Value(value="${blPU.hibernate.hbm2ddl.auto}")
protected String blPUHibernateHbm2ddlAuto

blPUHibernateDialect

@Value(value="${blPU.hibernate.dialect}")
protected String blPUHibernateDialect

blPUHibernateShow_sql

@Value(value="${blPU.hibernate.show_sql}")
protected String blPUHibernateShow_sql

blPUHibernateCacheUse_second_level_cache

@Value(value="${blPU.hibernate.cache.use_second_level_cache}")
protected String blPUHibernateCacheUse_second_level_cache

blPUHibernateCacheUse_query_cache

@Value(value="${blPU.hibernate.cache.use_query_cache}")
protected String blPUHibernateCacheUse_query_cache

blPUHibernateHbm2ddlImport_files

@Value(value="${blPU.hibernate.hbm2ddl.import_files}")
protected String blPUHibernateHbm2ddlImport_files

blCMSStorageHibernateHbm2ddlAuto

@Value(value="${blCMSStorage.hibernate.hbm2ddl.auto}")
protected String blCMSStorageHibernateHbm2ddlAuto

blCMSStorageHibernateDialect

@Value(value="${blCMSStorage.hibernate.dialect}")
protected String blCMSStorageHibernateDialect

blCMSStorageHibernateShow_sql

@Value(value="${blCMSStorage.hibernate.show_sql}")
protected String blCMSStorageHibernateShow_sql

blCMSStorageHibernateCacheUse_second_level_cache

@Value(value="${blCMSStorage.hibernate.cache.use_second_level_cache}")
protected String blCMSStorageHibernateCacheUse_second_level_cache

blCMSStorageHibernateCacheUse_query_cache

@Value(value="${blCMSStorage.hibernate.cache.use_query_cache}")
protected String blCMSStorageHibernateCacheUse_query_cache

blCMSStorageHibernateHbm2ddlImport_files

@Value(value="${blCMSStorage.hibernate.hbm2ddl.import_files}")
protected String blCMSStorageHibernateHbm2ddlImport_files

blSecurePUHibernateHbm2ddlAuto

@Value(value="${blSecurePU.hibernate.hbm2ddl.auto}")
protected String blSecurePUHibernateHbm2ddlAuto

blSecurePUHibernateDialect

@Value(value="${blSecurePU.hibernate.dialect}")
protected String blSecurePUHibernateDialect

blSecurePUHibernateShow_sql

@Value(value="${blSecurePU.hibernate.show_sql}")
protected String blSecurePUHibernateShow_sql

blSecurePUHibernateCacheUse_second_level_cache

@Value(value="${blSecurePU.hibernate.cache.use_second_level_cache}")
protected String blSecurePUHibernateCacheUse_second_level_cache

blSecurePUHibernateCacheUse_query_cache

@Value(value="${blSecurePU.hibernate.cache.use_query_cache}")
protected String blSecurePUHibernateCacheUse_query_cache

blSecurePUHibernateHbm2ddlImport_files

@Value(value="${blSecurePU.hibernate.hbm2ddl.import_files}")
protected String blSecurePUHibernateHbm2ddlImport_files
Constructor Detail

JPAPropertiesPersistenceUnitPostProcessor

public JPAPropertiesPersistenceUnitPostProcessor()
Method Detail

populatePresetProperties

@PostConstruct
public void populatePresetProperties()

postProcessPersistenceUnitInfo

public void postProcessPersistenceUnitInfo(org.springframework.orm.jpa.persistenceunit.MutablePersistenceUnitInfo pui)
Specified by:
postProcessPersistenceUnitInfo in interface org.springframework.orm.jpa.persistenceunit.PersistenceUnitPostProcessor

setPersistenceUnitProperties

public void setPersistenceUnitProperties(Map<String,String> properties)


Copyright © 2012. All Rights Reserved.